- Timestamp:
- Sep 17, 2007 3:44:47 PM (17 years ago)
- Location:
- pjproject/trunk/pjsip-apps/src/py_pjsua
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/py_pjsua/pjsua_app.py
r1430 r1438 20 20 # Set C_STUN_HOST to the address:port of the STUN server to enable STUN 21 21 # 22 #C_STUN_HOST = ""23 C_STUN_HOST = "192.168.0.2"22 C_STUN_HOST = "" 23 #C_STUN_HOST = "192.168.0.2" 24 24 #C_STUN_HOST = "stun.iptel.org:3478" 25 25 … … 268 268 acc_cfg.id = "sip:" + acc_username + "@" + acc_domain 269 269 acc_cfg.reg_uri = "sip:" + acc_domain 270 acc_cfg.cred_count = 1 271 acc_cfg.cred_info[0].realm = acc_domain 272 acc_cfg.cred_info[0].scheme = "digest" 273 acc_cfg.cred_info[0].username = acc_username 274 acc_cfg.cred_info[0].data_type = 0 275 acc_cfg.cred_info[0].data = acc_passwd 270 271 cred_info = py_pjsua.Pjsip_Cred_Info() 272 cred_info.realm = "*" 273 cred_info.scheme = "digest" 274 cred_info.username = acc_username 275 cred_info.data_type = 0 276 cred_info.data = acc_passwd 277 278 acc_cfg.cred_info.append(1) 279 acc_cfg.cred_info[0] = cred_info 276 280 277 281 # Add new SIP account … … 339 343 info = py_pjsua.conf_get_port_info(port) 340 344 txlist = "" 341 for i in range(info.listener_cnt):342 txlist = txlist + "#" + ` info.listeners[i]` + " "345 for listener in info.listeners: 346 txlist = txlist + "#" + `listener` + " " 343 347 344 348 print "Port #" + `info.slot_id` + "[" + `(info.clock_rate/1000)` + "KHz/" + `(info.samples_per_frame * 1000 / info.clock_rate)` + "ms] " + info.name + " transmitting to: " + txlist -
pjproject/trunk/pjsip-apps/src/py_pjsua/py_pjsua.c
r1430 r1438 2404 2404 unsigned samples_per_frame; 2405 2405 unsigned bits_per_sample; 2406 unsigned listener_cnt;2407 2406 PyListObject * listeners; 2408 2407 … … 2444 2443 } 2445 2444 2446 self->listeners = (PyListObject *)PyList_New( PJSUA_MAX_CONF_PORTS);2445 self->listeners = (PyListObject *)PyList_New(0); 2447 2446 if (self->listeners == NULL) 2448 2447 { … … 2488 2487 offsetof(PyObj_pjsua_conf_port_info, bits_per_sample), 0, 2489 2488 "Bits per sample" 2490 },2491 {2492 "listener_cnt", T_INT,2493 offsetof(PyObj_pjsua_conf_port_info, listener_cnt), 0,2494 "Number of listeners in the array."2495 2489 }, 2496 2490 { … … 3167 3161 pjsua_conf_port_info info; 3168 3162 int status; 3169 inti;3163 unsigned i; 3170 3164 3171 3165 PJ_UNUSED_ARG(pSelf); … … 3183 3177 obj->channel_count = info.bits_per_sample; 3184 3178 obj->clock_rate = info.clock_rate; 3185 obj->listener_cnt = info.listener_cnt;3186 3179 obj->name = PyString_FromStringAndSize(info.name.ptr, info.name.slen); 3187 3180 obj->samples_per_frame = info.samples_per_frame; 3188 3181 obj->slot_id = info.slot_id; 3189 3182 3190 for (i = 0; i < PJSUA_MAX_CONF_PORTS; i++) { 3183 obj->listeners = (PyListObject *)PyList_New(info.listener_cnt); 3184 for (i = 0; i < info.listener_cnt; i++) { 3191 3185 PyObject * item = Py_BuildValue("i",info.listeners[i]); 3192 3186 PyList_SetItem((PyObject *)obj->listeners, i, item); -
pjproject/trunk/pjsip-apps/src/py_pjsua/py_pjsua.h
r1430 r1438 29 29 pj_str_t str; 30 30 31 str.ptr = PyString_AS_STRING(obj); 32 str.slen = PyString_GET_SIZE(obj); 31 if (obj) { 32 str.ptr = PyString_AS_STRING(obj); 33 str.slen = PyString_GET_SIZE(obj); 34 } else { 35 str.ptr = NULL; 36 str.slen = 0; 37 } 33 38 34 39 return str; … … 1906 1911 cfg->force_contact.slen); 1907 1912 Py_XDECREF(obj->proxy); 1908 obj->proxy = (PyListObject *)PyList_New( 8);1913 obj->proxy = (PyListObject *)PyList_New(0); 1909 1914 for (i=0; i<cfg->proxy_cnt; ++i) { 1910 1915 PyObject * str; 1911 1916 str = PyString_FromStringAndSize(cfg->proxy[i].ptr, 1912 1917 cfg->proxy[i].slen); 1913 PyList_ SetItem((PyObject *)obj->proxy, i, str);1918 PyList_Append((PyObject *)obj->proxy, str); 1914 1919 } 1915 1920 … … 1917 1922 1918 1923 Py_XDECREF(obj->cred_info); 1919 obj->cred_info = (PyListObject *)PyList_New( 8);1924 obj->cred_info = (PyListObject *)PyList_New(0); 1920 1925 for (i=0; i<cfg->cred_count; ++i) { 1921 1926 PyObj_pjsip_cred_info * ci; … … 1924 1929 PyObj_pjsip_cred_info_new(&PyTyp_pjsip_cred_info,NULL,NULL); 1925 1930 PyObj_pjsip_cred_info_import(ci, &cfg->cred_info[i]); 1926 PyList_ SetItem((PyObject *)obj->cred_info, i, (PyObject *)ci);1931 PyList_Append((PyObject *)obj->cred_info, (PyObject *)ci); 1927 1932 } 1928 1933 … … 1992 1997 return NULL; 1993 1998 } 1994 self->proxy = (PyListObject *)PyList_New( 8);1999 self->proxy = (PyListObject *)PyList_New(0); 1995 2000 if (self->proxy == NULL) { 1996 2001 Py_DECREF(self); 1997 2002 return NULL; 1998 2003 } 1999 self->cred_info = (PyListObject *)PyList_New( 8);2004 self->cred_info = (PyListObject *)PyList_New(0); 2000 2005 if (self->cred_info == NULL) { 2001 2006 Py_DECREF(self);
Note: See TracChangeset
for help on using the changeset viewer.