/* * Module code. * * Generated by SIP 4.1.1 (4.1.1-255) on Fri Feb 9 10:28:23 2007 */ #include "sipAPIpy_sems.h" #include "sippy_semsPySemsDialog.h" #include "sippy_semsAmSipDialog.h" #include "sippy_semsAmSipReply.h" #include "sippy_semsAmSipRequest.h" #include "sippy_semsstring.h" /* Define the strings used by this module. */ char sipNm_py_sems_onOtherReply[] = "onOtherReply"; char sipNm_py_sems_onOtherBye[] = "onOtherBye"; char sipNm_py_sems_onDtmf[] = "onDtmf"; char sipNm_py_sems_onCancel[] = "onCancel"; char sipNm_py_sems_onBye[] = "onBye"; char sipNm_py_sems_onSessionStart[] = "onSessionStart"; char sipNm_py_sems_onInvite[] = "onInvite"; char sipNm_py_sems_setStopped[] = "setStopped"; char sipNm_py_sems_acceptAudio[] = "acceptAudio"; char sipNm_py_sems_dlg[] = "dlg"; char sipNm_py_sems_PySemsDialog[] = "PySemsDialog"; char sipNm_py_sems_reinvite[] = "reinvite"; char sipNm_py_sems_update[] = "update"; char sipNm_py_sems_cancel[] = "cancel"; char sipNm_py_sems_bye[] = "bye"; char sipNm_py_sems_sendRequest[] = "sendRequest"; char sipNm_py_sems_reply[] = "reply"; char sipNm_py_sems_updateStatus[] = "updateStatus"; char sipNm_py_sems_getContactHdr[] = "getContactHdr"; char sipNm_py_sems_getStatus[] = "getStatus"; char sipNm_py_sems_getUACTransPending[] = "getUACTransPending"; char sipNm_py_sems_setRoute[] = "setRoute"; char sipNm_py_sems_getRoute[] = "getRoute"; char sipNm_py_sems_local_party[] = "local_party"; char sipNm_py_sems_remote_party[] = "remote_party"; char sipNm_py_sems_contact_uri[] = "contact_uri"; char sipNm_py_sems_remote_uri[] = "remote_uri"; char sipNm_py_sems_local_uri[] = "local_uri"; char sipNm_py_sems_sip_port[] = "sip_port"; char sipNm_py_sems_sip_ip[] = "sip_ip"; char sipNm_py_sems_Disconnecting[] = "Disconnecting"; char sipNm_py_sems_Connected[] = "Connected"; char sipNm_py_sems_Pending[] = "Pending"; char sipNm_py_sems_Disconnected[] = "Disconnected"; char sipNm_py_sems_AmSipDialog[] = "AmSipDialog"; char sipNm_py_sems_local_tag[] = "local_tag"; char sipNm_py_sems_remote_tag[] = "remote_tag"; char sipNm_py_sems_next_request_uri[] = "next_request_uri"; char sipNm_py_sems_reason[] = "reason"; char sipNm_py_sems_code[] = "code"; char sipNm_py_sems_AmSipReply[] = "AmSipReply"; char sipNm_py_sems_getHeader[] = "getHeader"; char sipNm_py_sems_key[] = "key"; char sipNm_py_sems_next_hop[] = "next_hop"; char sipNm_py_sems_route[] = "route"; char sipNm_py_sems_body[] = "body"; char sipNm_py_sems_hdrs[] = "hdrs"; char sipNm_py_sems_cseq[] = "cseq"; char sipNm_py_sems_to_tag[] = "to_tag"; char sipNm_py_sems_from_tag[] = "from_tag"; char sipNm_py_sems_callid[] = "callid"; char sipNm_py_sems_to[] = "to"; char sipNm_py_sems_from[] = "from"; char sipNm_py_sems_from_uri[] = "from_uri"; char sipNm_py_sems_r_uri[] = "r_uri"; char sipNm_py_sems_port[] = "port"; char sipNm_py_sems_dstip[] = "dstip"; char sipNm_py_sems_domain[] = "domain"; char sipNm_py_sems_user[] = "user"; char sipNm_py_sems_method[] = "method"; char sipNm_py_sems_cmd[] = "cmd"; char sipNm_py_sems_AmSipRequest[] = "AmSipRequest"; char sipNm_py_sems_string[] = "string"; void sipVH_py_sems_0(sip_gilstate_t sipGILState,PyObject *sipMethod,const AmSipReply& a0) { PyObject *sipResObj = sipCallMethod(0,sipMethod,"O",const_cast(&a0),sipClass_AmSipReply); if (!sipResObj || sipParseResult(0,sipMethod,sipResObj,"Z") < 0) PyErr_Print(); Py_XDECREF(sipResObj); Py_DECREF(sipMethod); SIP_RELEASE_GIL(sipGILState) } void sipVH_py_sems_1(sip_gilstate_t sipGILState,PyObject *sipMethod,const AmSipRequest& a0) { PyObject *sipResObj = sipCallMethod(0,sipMethod,"O",const_cast(&a0),sipClass_AmSipRequest); if (!sipResObj || sipParseResult(0,sipMethod,sipResObj,"Z") < 0) PyErr_Print(); Py_XDECREF(sipResObj); Py_DECREF(sipMethod); SIP_RELEASE_GIL(sipGILState) } void sipVH_py_sems_2(sip_gilstate_t sipGILState,PyObject *sipMethod,int a0,int a1) { PyObject *sipResObj = sipCallMethod(0,sipMethod,"ii",a0,a1); if (!sipResObj || sipParseResult(0,sipMethod,sipResObj,"Z") < 0) PyErr_Print(); Py_XDECREF(sipResObj); Py_DECREF(sipMethod); SIP_RELEASE_GIL(sipGILState) } void sipVH_py_sems_3(sip_gilstate_t sipGILState,PyObject *sipMethod) { PyObject *sipResObj = sipCallMethod(0,sipMethod,""); if (!sipResObj || sipParseResult(0,sipMethod,sipResObj,"Z") < 0) PyErr_Print(); Py_XDECREF(sipResObj); Py_DECREF(sipMethod); SIP_RELEASE_GIL(sipGILState) } static PyObject *func_getHeader(PyObject *,PyObject *sipArgs) { int sipArgsParsed = 0; { const string * a0; int a0IsTemp = 0; const string * a1; int a1IsTemp = 0; if (sipParseArgs(&sipArgsParsed,sipArgs,"M1M1",sipConvertTo_string,&a0,&a0IsTemp,sipConvertTo_string,&a1,&a1IsTemp)) { string *sipRes; sipRes = new string(getHeader(*a0,*a1)); if (a0IsTemp) delete const_cast(a0); if (a1IsTemp) delete const_cast(a1); PyObject *sipResObj = sipConvertFrom_string(sipRes); delete sipRes; return sipResObj; } } /* Raise an exception if the arguments couldn't be parsed. */ sipNoFunction(sipArgsParsed,sipNm_py_sems_getHeader); return NULL; } /* * This defines each class in this module. The values are replaced by the * proper Python types during the export process. */ static sipWrapperType *typesTable[] = { (sipWrapperType *)&sipType_PySemsDialog, (sipWrapperType *)&sipType_AmSipDialog, (sipWrapperType *)&sipType_AmSipReply, (sipWrapperType *)&sipType_AmSipRequest, 0 }; /* This defines each mapped type in this module. */ static sipMappedTypeDef *mappedTypesTable[] = { &sipMappedType_string, }; /* * This defines the virtual handlers that this module implements and can be * used by other modules. */ static sipVirtHandlerFunc virtHandlersTable[] = { (sipVirtHandlerFunc)sipVH_py_sems_0, (sipVirtHandlerFunc)sipVH_py_sems_1, (sipVirtHandlerFunc)sipVH_py_sems_2, (sipVirtHandlerFunc)sipVH_py_sems_3, }; /* This defines this module. */ sipExportedModuleDef sipModuleAPI_py_sems = { NULL, "py_sems", 0, NULL, -1, typesTable, mappedTypesTable, virtHandlersTable, NULL, {NULL, NULL, NULL, NULL, NULL, NULL}, NULL }; /* The SIP API and the APIs of any imported modules. */ const sipAPIDef *sipAPI_py_sems; /* The Python module initialisation function. */ PyMODINIT_FUNC initpy_sems() { static PyMethodDef methods[] = { {sipNm_py_sems_getHeader, func_getHeader, METH_VARARGS, NULL}, {0, 0, 0, 0} }; /* Initialise the module. */ PyObject *mod = Py_InitModule(sipModuleAPI_py_sems.em_name,methods); PyObject *mdict = PyModule_GetDict(mod); /* Import the SIP module and get it's API. */ PyObject *sipmod = PyImport_ImportModule("sip"); if (sipmod == NULL) return; PyObject *capiobj = PyDict_GetItemString(PyModule_GetDict(sipmod),"_C_API"); if (capiobj == NULL || !PyCObject_Check(capiobj)) return; sipAPI_py_sems = reinterpret_cast(PyCObject_AsVoidPtr(capiobj)); /* Export the module and publish it's API. */ if (sipAPI_py_sems -> api_export_module(&sipModuleAPI_py_sems,SIP_API_MAJOR_NR,SIP_API_MINOR_NR,mdict) < 0) return; }