Changeset 915 for pjproject/trunk
- Timestamp:
- Jan 29, 2007 12:09:33 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/py_pjsua/py_pjsua.c
r914 r915 34 34 static void cb_reconfigure_logging(int level, const char *data, pj_size_t len) 35 35 { 36 36 37 if (PyCallable_Check(obj_reconfigure_logging)) 37 38 { … … 50 51 static void cb_logging_init(int level, const char *data, pj_size_t len) 51 52 { 53 52 54 if (PyCallable_Check(obj_logging_init)) 53 55 { … … 183 185 static void cb_on_call_state(pjsua_call_id call_id, pjsip_event *e) 184 186 { 187 188 printf("on_call_state called\n"); 185 189 if (PyCallable_Check(obj_callback->on_call_state)) 186 { 187 pjsip_event_Object * obj = 188 (pjsip_event_Object *)PyType_GenericNew(&pjsip_event_Type, 190 { 191 pjsip_event_Object * obj; 192 193 obj = 194 (pjsip_event_Object *)PyType_GenericNew(&pjsip_event_Type, 189 195 NULL, NULL); 190 obj->event = e; 191 196 197 obj->event = e; 198 192 199 PyObject_CallFunctionObjArgs( 193 200 obj_callback->on_call_state,Py_BuildValue("i",call_id),obj,NULL 194 201 ); 202 195 203 } 196 204 } … … 204 212 pjsip_rx_data *rdata) 205 213 { 214 printf("on_incoming_call called\n"); 206 215 if (PyCallable_Check(obj_callback->on_incoming_call)) 207 216 { … … 228 237 static void cb_on_call_media_state(pjsua_call_id call_id) 229 238 { 239 printf("on_call_media_state called\n"); 230 240 if (PyCallable_Check(obj_callback->on_call_media_state)) 231 241 { … … 245 255 PyObject * ret; 246 256 int cd; 257 printf("on_call_transfer_request called\n"); 247 258 if (PyCallable_Check(obj_callback->on_call_transfer_request)) 248 259 { … … 280 291 PyObject * ret; 281 292 int cnt; 293 printf("on_call_transfer_status called\n"); 282 294 if (PyCallable_Check(obj_callback->on_call_transfer_status)) 283 295 { … … 315 327 PyObject * txt; 316 328 int cd; 329 printf("on_call_replace_request called\n"); 317 330 if (PyCallable_Check(obj_callback->on_call_replace_request)) 318 331 { … … 351 364 pjsua_call_id new_call_id) 352 365 { 366 printf("on_call_replaced\n"); 353 367 if (PyCallable_Check(obj_callback->on_call_replaced)) 354 368 { … … 369 383 static void cb_on_reg_state(pjsua_acc_id acc_id) 370 384 { 385 printf("on_reg_state\n"); 371 386 if (PyCallable_Check(obj_callback->on_reg_state)) 372 387 { … … 382 397 static void cb_on_buddy_state(pjsua_buddy_id buddy_id) 383 398 { 399 printf("on_buddy_state called\n"); 384 400 if (PyCallable_Check(obj_callback->on_buddy_state)) 385 401 { … … 396 412 const pj_str_t *mime_type, const pj_str_t *body) 397 413 { 414 printf("on_pager called\n"); 398 415 if (PyCallable_Check(obj_callback->on_pager)) 399 416 { … … 419 436 const pj_str_t *reason) 420 437 { 438 421 439 PyObject * obj = PyType_GenericNew(user_data, NULL, NULL); 440 printf("on_pager_status called\n"); 422 441 if (PyCallable_Check(obj_callback->on_pager)) 423 442 { … … 441 460 pj_bool_t is_typing) 442 461 { 462 printf("on_typing called\n"); 443 463 if (PyCallable_Check(obj_callback->on_typing)) 444 464 { … … 595 615 }, 596 616 { 597 "on_call_media_ _state", T_OBJECT_EX,617 "on_call_media_state", T_OBJECT_EX, 598 618 offsetof(callback_Object, on_call_media_state), 0, 599 619 "Notify application when media state in the call has changed. Normal " … … 1297 1317 if (PyTuple_Check(tuple)) { 1298 1318 hname.ptr = PyString_AsString(PyTuple_GetItem(tuple,0)); 1299 hname.slen = strlen(PyString_AsString(PyTuple_GetItem(tuple,0))); 1319 hname.slen = strlen(PyString_AsString 1320 (PyTuple_GetItem(tuple,0))); 1300 1321 hvalue.ptr = PyString_AsString(PyTuple_GetItem(tuple,1)); 1301 hvalue.slen = strlen(PyString_AsString(PyTuple_GetItem(tuple,1))); 1322 hvalue.slen = strlen(PyString_AsString 1323 (PyTuple_GetItem(tuple,1))); 1302 1324 } else { 1303 1325 hname.ptr = ""; … … 1769 1791 } 1770 1792 pjsua_media_config_default(&cfg); 1771 obj = (media_config_Object *)PyType_GenericNew(&media_config_Type, NULL, NULL); 1793 obj = (media_config_Object *)PyType_GenericNew 1794 (&media_config_Type, NULL, NULL); 1772 1795 obj->clock_rate = cfg.clock_rate; 1773 1796 obj->ec_options = cfg.ec_options; … … 1810 1833 ); 1811 1834 1812 translate_hdr_rev((pjsip_generic_string_hdr *)&msg.hdr_list, 1835 translate_hdr_rev((pjsip_generic_string_hdr *)&msg.hdr_list,obj->hdr_list); 1813 1836 1814 1837 return (PyObject *)obj; … … 1821 1844 static PyObject *py_pjsua_reconfigure_logging(PyObject *pSelf, PyObject *pArgs) 1822 1845 { 1846 PyObject * logObj; 1823 1847 logging_config_Object *log; 1824 1848 pjsua_logging_config cfg; 1825 1849 pj_status_t status; 1826 1850 1827 if (!PyArg_ParseTuple(pArgs, "O", &log)) 1828 { 1829 return NULL; 1830 } 1831 cfg.msg_logging = log->msg_logging; 1832 cfg.level = log->level; 1833 cfg.console_level = log->console_level; 1834 cfg.decor = log->decor; 1835 cfg.log_filename.ptr = PyString_AsString(log->log_filename); 1836 cfg.log_filename.slen = strlen(cfg.log_filename.ptr); 1837 Py_XDECREF(obj_reconfigure_logging); 1838 obj_reconfigure_logging = log->cb; 1839 Py_INCREF(obj_reconfigure_logging); 1840 cfg.cb = &cb_reconfigure_logging; 1841 status = pjsua_reconfigure_logging(&cfg); 1851 if (!PyArg_ParseTuple(pArgs, "O", &logObj)) 1852 { 1853 return NULL; 1854 } 1855 if (logObj != Py_None) { 1856 log = (logging_config_Object *)logObj; 1857 cfg.msg_logging = log->msg_logging; 1858 cfg.level = log->level; 1859 cfg.console_level = log->console_level; 1860 cfg.decor = log->decor; 1861 cfg.log_filename.ptr = PyString_AsString(log->log_filename); 1862 cfg.log_filename.slen = strlen(cfg.log_filename.ptr); 1863 Py_XDECREF(obj_reconfigure_logging); 1864 obj_reconfigure_logging = log->cb; 1865 Py_INCREF(obj_reconfigure_logging); 1866 cfg.cb = &cb_reconfigure_logging; 1867 status = pjsua_reconfigure_logging(&cfg); 1868 } else { 1869 status = pjsua_reconfigure_logging(NULL); 1870 } 1842 1871 return Py_BuildValue("i",status); 1843 1872 } … … 1974 2003 { 1975 2004 pj_status_t status; 2005 PyObject * ua_cfgObj; 1976 2006 config_Object * ua_cfg; 2007 PyObject * log_cfgObj; 1977 2008 logging_config_Object * log_cfg; 2009 PyObject * media_cfgObj; 1978 2010 media_config_Object * media_cfg; 1979 2011 pjsua_config cfg_ua; 2012 pjsua_config * p_cfg_ua; 1980 2013 pjsua_logging_config cfg_log; 2014 pjsua_logging_config * p_cfg_log; 1981 2015 pjsua_media_config cfg_media; 2016 pjsua_media_config * p_cfg_media; 1982 2017 unsigned i; 1983 2018 1984 if (!PyArg_ParseTuple(pArgs, "OOO", &ua_cfg, &log_cfg, &media_cfg)) 1985 { 1986 return NULL; 1987 } 1988 2019 if (!PyArg_ParseTuple(pArgs, "OOO", &ua_cfgObj, &log_cfgObj,&media_cfgObj)) 2020 { 2021 return NULL; 2022 } 2023 2024 1989 2025 pjsua_config_default(&cfg_ua); 1990 2026 pjsua_logging_config_default(&cfg_log); 1991 2027 pjsua_media_config_default(&cfg_media); 1992 cfg_ua.cred_count = ua_cfg->cred_count; 1993 for (i = 0; i < 4; i++) 1994 { 1995 cfg_ua.cred_info[i] = ua_cfg->cred_info[i]; 1996 } 1997 cfg_ua.max_calls = ua_cfg->max_calls; 1998 for (i = 0; i < PJSUA_ACC_MAX_PROXIES; i++) 1999 { 2000 cfg_ua.outbound_proxy[i] = ua_cfg->outbound_proxy[i]; 2001 } 2002 2003 cfg_ua.outbound_proxy_cnt = ua_cfg->outbound_proxy_cnt; 2004 cfg_ua.thread_cnt = ua_cfg->thread_cnt; 2005 cfg_ua.user_agent.ptr = PyString_AsString(ua_cfg->user_agent); 2006 cfg_ua.user_agent.slen = strlen(cfg_ua.user_agent.ptr); 2007 2008 obj_callback = ua_cfg->cb; 2009 cfg_ua.cb.on_call_state = &cb_on_call_state; 2010 cfg_ua.cb.on_incoming_call = &cb_on_incoming_call; 2011 cfg_ua.cb.on_call_media_state = &cb_on_call_media_state; 2012 cfg_ua.cb.on_call_transfer_request = &cb_on_call_transfer_request; 2013 cfg_ua.cb.on_call_transfer_status = &cb_on_call_transfer_status; 2014 cfg_ua.cb.on_call_replace_request = &cb_on_call_replace_request; 2015 cfg_ua.cb.on_call_replaced = &cb_on_call_replaced; 2016 cfg_ua.cb.on_reg_state = &cb_on_reg_state; 2017 cfg_ua.cb.on_buddy_state = &cb_on_buddy_state; 2018 cfg_ua.cb.on_pager = &cb_on_pager; 2019 cfg_ua.cb.on_pager_status = &cb_on_pager_status; 2020 cfg_ua.cb.on_typing = &cb_on_typing; 2021 2022 cfg_log.msg_logging = log_cfg->msg_logging; 2023 cfg_log.level = log_cfg->level; 2024 cfg_log.console_level = log_cfg->console_level; 2025 cfg_log.decor = log_cfg->decor; 2026 cfg_log.log_filename.ptr = PyString_AsString(log_cfg->log_filename); 2027 cfg_log.log_filename.slen = strlen(cfg_log.log_filename.ptr); 2028 Py_XDECREF(obj_logging_init); 2029 obj_logging_init = log_cfg->cb; 2030 Py_INCREF(obj_logging_init); 2031 cfg_log.cb = &cb_logging_init; 2032 2033 2034 cfg_media.clock_rate = media_cfg->clock_rate; 2035 cfg_media.ec_options = media_cfg->ec_options; 2036 cfg_media.ec_tail_len = media_cfg->ec_tail_len; 2037 cfg_media.has_ioqueue = media_cfg->has_ioqueue; 2038 cfg_media.ilbc_mode = media_cfg->ilbc_mode; 2039 cfg_media.max_media_ports = media_cfg->max_media_ports; 2040 cfg_media.no_vad = media_cfg->no_vad; 2041 cfg_media.ptime = media_cfg->ptime; 2042 cfg_media.quality = media_cfg->quality; 2043 cfg_media.rx_drop_pct = media_cfg->rx_drop_pct; 2044 cfg_media.thread_cnt = media_cfg->thread_cnt; 2045 cfg_media.tx_drop_pct = media_cfg->tx_drop_pct; 2046 2047 status = pjsua_init(&cfg_ua, &cfg_log, &cfg_media); 2028 2029 if (ua_cfgObj != Py_None) { 2030 ua_cfg = (config_Object *)ua_cfgObj; 2031 cfg_ua.cred_count = ua_cfg->cred_count; 2032 for (i = 0; i < 4; i++) 2033 { 2034 cfg_ua.cred_info[i] = ua_cfg->cred_info[i]; 2035 } 2036 cfg_ua.max_calls = ua_cfg->max_calls; 2037 for (i = 0; i < PJSUA_ACC_MAX_PROXIES; i++) 2038 { 2039 cfg_ua.outbound_proxy[i] = ua_cfg->outbound_proxy[i]; 2040 } 2041 2042 cfg_ua.outbound_proxy_cnt = ua_cfg->outbound_proxy_cnt; 2043 cfg_ua.thread_cnt = ua_cfg->thread_cnt; 2044 cfg_ua.user_agent.ptr = PyString_AsString(ua_cfg->user_agent); 2045 cfg_ua.user_agent.slen = strlen(cfg_ua.user_agent.ptr); 2046 2047 obj_callback = ua_cfg->cb; 2048 cfg_ua.cb.on_call_state = &cb_on_call_state; 2049 cfg_ua.cb.on_incoming_call = &cb_on_incoming_call; 2050 cfg_ua.cb.on_call_media_state = &cb_on_call_media_state; 2051 cfg_ua.cb.on_call_transfer_request = &cb_on_call_transfer_request; 2052 cfg_ua.cb.on_call_transfer_status = &cb_on_call_transfer_status; 2053 cfg_ua.cb.on_call_replace_request = &cb_on_call_replace_request; 2054 cfg_ua.cb.on_call_replaced = &cb_on_call_replaced; 2055 cfg_ua.cb.on_reg_state = &cb_on_reg_state; 2056 cfg_ua.cb.on_buddy_state = &cb_on_buddy_state; 2057 cfg_ua.cb.on_pager = &cb_on_pager; 2058 cfg_ua.cb.on_pager_status = &cb_on_pager_status; 2059 cfg_ua.cb.on_typing = &cb_on_typing; 2060 p_cfg_ua = &cfg_ua; 2061 } else { 2062 p_cfg_ua = NULL; 2063 } 2064 if (log_cfgObj != Py_None) { 2065 log_cfg = (logging_config_Object *)log_cfgObj; 2066 cfg_log.msg_logging = log_cfg->msg_logging; 2067 cfg_log.level = log_cfg->level; 2068 cfg_log.console_level = log_cfg->console_level; 2069 cfg_log.decor = log_cfg->decor; 2070 cfg_log.log_filename.ptr = PyString_AsString(log_cfg->log_filename); 2071 cfg_log.log_filename.slen = strlen(cfg_log.log_filename.ptr); 2072 Py_XDECREF(obj_logging_init); 2073 obj_logging_init = log_cfg->cb; 2074 Py_INCREF(obj_logging_init); 2075 cfg_log.cb = &cb_logging_init; 2076 p_cfg_log = &cfg_log; 2077 } else { 2078 p_cfg_log = NULL; 2079 } 2080 if (media_cfgObj != Py_None) { 2081 media_cfg = (media_config_Object *)media_cfgObj; 2082 cfg_media.clock_rate = media_cfg->clock_rate; 2083 cfg_media.ec_options = media_cfg->ec_options; 2084 cfg_media.ec_tail_len = media_cfg->ec_tail_len; 2085 cfg_media.has_ioqueue = media_cfg->has_ioqueue; 2086 cfg_media.ilbc_mode = media_cfg->ilbc_mode; 2087 cfg_media.max_media_ports = media_cfg->max_media_ports; 2088 cfg_media.no_vad = media_cfg->no_vad; 2089 cfg_media.ptime = media_cfg->ptime; 2090 cfg_media.quality = media_cfg->quality; 2091 cfg_media.rx_drop_pct = media_cfg->rx_drop_pct; 2092 cfg_media.thread_cnt = media_cfg->thread_cnt; 2093 cfg_media.tx_drop_pct = media_cfg->tx_drop_pct; 2094 p_cfg_media = &cfg_media; 2095 } else { 2096 p_cfg_media = NULL; 2097 } 2098 status = pjsua_init(p_cfg_ua, p_cfg_log, p_cfg_media); 2048 2099 return Py_BuildValue("i",status); 2049 2100 } … … 3058 3109 (PyObject *pSelf, PyObject *pArgs) 3059 3110 { 3111 PyObject * tmpObj; 3060 3112 stun_config_Object *obj; 3061 3113 pjsua_stun_config *cfg; 3062 3114 3063 if (!PyArg_ParseTuple(pArgs, "O", &obj)) 3064 { 3065 return NULL; 3066 } 3067 cfg = (pjsua_stun_config *)malloc(sizeof(pjsua_stun_config)); 3068 cfg->stun_port1 = obj->stun_port1; 3069 cfg->stun_port2 = obj->stun_port2; 3070 cfg->stun_srv1.ptr = PyString_AsString(obj->stun_srv1); 3071 cfg->stun_srv1.slen = strlen(PyString_AsString(obj->stun_srv1)); 3072 cfg->stun_srv2.ptr = PyString_AsString(obj->stun_srv2); 3073 cfg->stun_srv2.slen = strlen(PyString_AsString(obj->stun_srv2)); 3115 if (!PyArg_ParseTuple(pArgs, "O", &tmpObj)) 3116 { 3117 return NULL; 3118 } 3119 if (tmpObj != Py_None) 3120 { 3121 obj = (stun_config_Object *) tmpObj; 3122 cfg = (pjsua_stun_config *)malloc(sizeof(pjsua_stun_config)); 3123 cfg->stun_port1 = obj->stun_port1; 3124 cfg->stun_port2 = obj->stun_port2; 3125 cfg->stun_srv1.ptr = PyString_AsString(obj->stun_srv1); 3126 cfg->stun_srv1.slen = strlen(PyString_AsString(obj->stun_srv1)); 3127 cfg->stun_srv2.ptr = PyString_AsString(obj->stun_srv2); 3128 cfg->stun_srv2.slen = strlen(PyString_AsString(obj->stun_srv2)); 3129 } else { 3130 cfg = NULL; 3131 } 3074 3132 pjsua_normalize_stun_config(cfg); 3075 3133 obj->stun_port1 = cfg->stun_port1; … … 3095 3153 int type; 3096 3154 3155 PyObject * tmpObj; 3097 3156 transport_config_Object *obj; 3098 3157 pjsua_transport_config cfg; 3099 3158 pjsua_transport_id id; 3100 if (!PyArg_ParseTuple(pArgs, "iO", &type, &obj)) 3101 { 3102 return NULL; 3103 } 3104 cfg.public_addr.ptr = PyString_AsString(obj->public_addr); 3105 cfg.public_addr.slen = strlen(PyString_AsString(obj->public_addr)); 3106 cfg.bound_addr.ptr = PyString_AsString(obj->bound_addr); 3107 cfg.bound_addr.slen = strlen(PyString_AsString(obj->bound_addr)); 3108 cfg.port = obj->port; 3109 cfg.use_stun = obj->use_stun; 3110 cfg.stun_config.stun_port1 = obj->stun_config->stun_port1; 3111 cfg.stun_config.stun_port2 = obj->stun_config->stun_port2; 3112 cfg.stun_config.stun_srv1.ptr = 3113 PyString_AsString(obj->stun_config->stun_srv1); 3114 cfg.stun_config.stun_srv1.slen = 3115 strlen(PyString_AsString(obj->stun_config->stun_srv1)); 3116 cfg.stun_config.stun_srv2.ptr = 3117 PyString_AsString(obj->stun_config->stun_srv2); 3118 cfg.stun_config.stun_srv2.slen = 3119 strlen(PyString_AsString(obj->stun_config->stun_srv2)); 3120 status = pjsua_transport_create(type, &cfg, &id); 3159 if (!PyArg_ParseTuple(pArgs, "iO", &type, &tmpObj)) 3160 { 3161 return NULL; 3162 } 3163 if (tmpObj != Py_None) 3164 { 3165 obj = (transport_config_Object *)tmpObj; 3166 cfg.public_addr.ptr = PyString_AsString(obj->public_addr); 3167 cfg.public_addr.slen = strlen(PyString_AsString(obj->public_addr)); 3168 cfg.bound_addr.ptr = PyString_AsString(obj->bound_addr); 3169 cfg.bound_addr.slen = strlen(PyString_AsString(obj->bound_addr)); 3170 cfg.port = obj->port; 3171 cfg.use_stun = obj->use_stun; 3172 cfg.stun_config.stun_port1 = obj->stun_config->stun_port1; 3173 cfg.stun_config.stun_port2 = obj->stun_config->stun_port2; 3174 cfg.stun_config.stun_srv1.ptr = 3175 PyString_AsString(obj->stun_config->stun_srv1); 3176 cfg.stun_config.stun_srv1.slen = 3177 strlen(PyString_AsString(obj->stun_config->stun_srv1)); 3178 cfg.stun_config.stun_srv2.ptr = 3179 PyString_AsString(obj->stun_config->stun_srv2); 3180 cfg.stun_config.stun_srv2.slen = 3181 strlen(PyString_AsString(obj->stun_config->stun_srv2)); 3182 status = pjsua_transport_create(type, &cfg, &id); 3183 } else { 3184 status = pjsua_transport_create(type, NULL, &id); 3185 } 3121 3186 3122 3187 … … 3131 3196 { 3132 3197 pj_status_t status; 3198 PyObject * tmpObj; 3133 3199 pjsip_transport_Object *obj; 3134 3200 pjsua_transport_id id; 3135 if (!PyArg_ParseTuple(pArgs, "O", &obj)) 3136 { 3137 return NULL; 3138 } 3139 3140 3141 status = pjsua_transport_register(obj->tp, &id); 3201 if (!PyArg_ParseTuple(pArgs, "O", &tmpObj)) 3202 { 3203 return NULL; 3204 } 3205 if (tmpObj != Py_None) 3206 { 3207 obj = (pjsip_transport_Object *)tmpObj; 3208 status = pjsua_transport_register(obj->tp, &id); 3209 } else { 3210 status = pjsua_transport_register(NULL, &id); 3211 } 3142 3212 3143 3213 return Py_BuildValue("ii",status, id); … … 3154 3224 3155 3225 pjsua_transport_id id[PJSIP_MAX_TRANSPORTS]; 3156 intc, i;3226 unsigned c, i; 3157 3227 if (!PyArg_ParseTuple(pArgs, "")) 3158 3228 { … … 3172 3242 } 3173 3243 } 3174 3175 3244 3176 3245 return Py_BuildValue("O",list); … … 3879 3948 { 3880 3949 int is_default; 3950 PyObject * acObj; 3881 3951 acc_config_Object * ac; 3882 3952 pjsua_acc_config cfg; … … 3886 3956 int i; 3887 3957 3888 if (!PyArg_ParseTuple(pArgs, "Oi", &ac, &is_default)) 3889 { 3890 return NULL; 3891 } 3892 cfg.cred_count = ac->cred_count; 3893 for (i = 0; i < 8; i++) 3894 { 3895 /*cfg.cred_info[i] = ac->cred_info[i];*/ 3896 pjsip_cred_info_Object * ci = (pjsip_cred_info_Object *)PyList_GetItem((PyObject *)ac->cred_info,i); 3897 cfg.cred_info[i].data.ptr = PyString_AsString(ci->data); 3898 cfg.cred_info[i].data.slen = strlen(PyString_AsString(ci->data)); 3899 cfg.cred_info[i].realm.ptr = PyString_AsString(ci->realm); 3900 cfg.cred_info[i].realm.slen = strlen(PyString_AsString(ci->realm)); 3901 cfg.cred_info[i].scheme.ptr = PyString_AsString(ci->scheme); 3902 cfg.cred_info[i].scheme.slen = strlen(PyString_AsString(ci->scheme)); 3903 cfg.cred_info[i].username.ptr = PyString_AsString(ci->username); 3904 cfg.cred_info[i].username.slen = strlen(PyString_AsString(ci->username)); 3905 cfg.cred_info[i].data_type = ci->data_type; 3906 } 3907 cfg.force_contact.ptr = PyString_AsString(ac->force_contact); 3908 cfg.force_contact.slen = strlen(PyString_AsString(ac->force_contact)); 3909 cfg.id.ptr = PyString_AsString(ac->id); 3910 cfg.id.slen = strlen(PyString_AsString(ac->id)); 3911 cfg.priority = ac->priority; 3912 for (i = 0; i < 8; i++) { 3913 /*cfg.proxy[i] = ac->proxy[i];*/ 3914 cfg.proxy[i].ptr = PyString_AsString(PyList_GetItem((PyObject *)ac->proxy,i)); 3915 } 3916 cfg.proxy_cnt = ac->proxy_cnt; 3917 cfg.publish_enabled = ac->publish_enabled; 3918 cfg.reg_timeout = ac->reg_timeout; 3919 cfg.reg_uri.ptr = PyString_AsString(ac->reg_uri); 3920 cfg.reg_uri.slen = strlen(PyString_AsString(ac->reg_uri)); 3921 3922 status = pjsua_acc_add(&cfg, is_default, &p_acc_id); 3958 if (!PyArg_ParseTuple(pArgs, "Oi", &acObj, &is_default)) 3959 { 3960 return NULL; 3961 } 3962 if (acObj != Py_None) 3963 { 3964 ac = (acc_config_Object *)acObj; 3965 cfg.cred_count = ac->cred_count; 3966 for (i = 0; i < 8; i++) 3967 { 3968 /*cfg.cred_info[i] = ac->cred_info[i];*/ 3969 pjsip_cred_info_Object * ci = (pjsip_cred_info_Object *) 3970 PyList_GetItem((PyObject *)ac->cred_info,i); 3971 cfg.cred_info[i].data.ptr = PyString_AsString(ci->data); 3972 cfg.cred_info[i].data.slen = strlen(PyString_AsString(ci->data)); 3973 cfg.cred_info[i].realm.ptr = PyString_AsString(ci->realm); 3974 cfg.cred_info[i].realm.slen = strlen(PyString_AsString(ci->realm)); 3975 cfg.cred_info[i].scheme.ptr = PyString_AsString(ci->scheme); 3976 cfg.cred_info[i].scheme.slen = strlen 3977 (PyString_AsString(ci->scheme)); 3978 cfg.cred_info[i].username.ptr = PyString_AsString(ci->username); 3979 cfg.cred_info[i].username.slen = strlen 3980 (PyString_AsString(ci->username)); 3981 cfg.cred_info[i].data_type = ci->data_type; 3982 } 3983 cfg.force_contact.ptr = PyString_AsString(ac->force_contact); 3984 cfg.force_contact.slen = strlen(PyString_AsString(ac->force_contact)); 3985 cfg.id.ptr = PyString_AsString(ac->id); 3986 cfg.id.slen = strlen(PyString_AsString(ac->id)); 3987 cfg.priority = ac->priority; 3988 for (i = 0; i < 8; i++) { 3989 /*cfg.proxy[i] = ac->proxy[i];*/ 3990 cfg.proxy[i].ptr = PyString_AsString 3991 (PyList_GetItem((PyObject *)ac->proxy,i)); 3992 } 3993 cfg.proxy_cnt = ac->proxy_cnt; 3994 cfg.publish_enabled = ac->publish_enabled; 3995 cfg.reg_timeout = ac->reg_timeout; 3996 cfg.reg_uri.ptr = PyString_AsString(ac->reg_uri); 3997 cfg.reg_uri.slen = strlen(PyString_AsString(ac->reg_uri)); 3998 3999 status = pjsua_acc_add(&cfg, is_default, &p_acc_id); 4000 } else { 4001 status = pjsua_acc_add(NULL, is_default, &p_acc_id); 4002 } 3923 4003 3924 4004 return Py_BuildValue("ii", status, p_acc_id); … … 3939 4019 3940 4020 3941 if (!PyArg_ParseTuple(pArgs, "ii O", &tid, &is_default))4021 if (!PyArg_ParseTuple(pArgs, "ii", &tid, &is_default)) 3942 4022 { 3943 4023 return NULL; … … 3975 4055 (PyObject *pSelf, PyObject *pArgs) 3976 4056 { 4057 PyObject * acObj; 3977 4058 acc_config_Object * ac; 3978 4059 pjsua_acc_config cfg; … … 3981 4062 int i; 3982 4063 3983 if (!PyArg_ParseTuple(pArgs, "iO", &acc_id, &ac)) 3984 { 3985 return NULL; 3986 } 3987 cfg.cred_count = ac->cred_count; 3988 for (i = 0; i < 8; i++) 3989 { 3990 /*cfg.cred_info[i] = ac->cred_info[i];*/ 3991 pjsip_cred_info_Object * ci = (pjsip_cred_info_Object *)PyList_GetItem((PyObject *)ac->cred_info,i); 3992 cfg.cred_info[i].data.ptr = PyString_AsString(ci->data); 3993 cfg.cred_info[i].data.slen = strlen(PyString_AsString(ci->data)); 3994 cfg.cred_info[i].realm.ptr = PyString_AsString(ci->realm); 3995 cfg.cred_info[i].realm.slen = strlen(PyString_AsString(ci->realm)); 3996 cfg.cred_info[i].scheme.ptr = PyString_AsString(ci->scheme); 3997 cfg.cred_info[i].scheme.slen = strlen(PyString_AsString(ci->scheme)); 3998 cfg.cred_info[i].username.ptr = PyString_AsString(ci->username); 3999 cfg.cred_info[i].username.slen = strlen(PyString_AsString(ci->username)); 4000 } 4001 cfg.force_contact.ptr = PyString_AsString(ac->force_contact); 4002 cfg.force_contact.slen = strlen(PyString_AsString(ac->force_contact)); 4003 cfg.id.ptr = PyString_AsString(ac->id); 4004 cfg.id.slen = strlen(PyString_AsString(ac->id)); 4005 cfg.priority = ac->priority; 4006 for (i = 0; i < 8; i++) { 4007 /*cfg.proxy[i] = ac->proxy[i];*/ 4008 cfg.proxy[i].ptr = PyString_AsString(PyList_GetItem((PyObject *)ac->proxy,i)); 4009 } 4010 cfg.proxy_cnt = ac->proxy_cnt; 4011 cfg.publish_enabled = ac->publish_enabled; 4012 cfg.reg_timeout = ac->reg_timeout; 4013 cfg.reg_uri.ptr = PyString_AsString(ac->reg_uri); 4014 cfg.reg_uri.slen = strlen(PyString_AsString(ac->reg_uri)); 4015 status = pjsua_acc_modify(acc_id, &cfg); 4064 if (!PyArg_ParseTuple(pArgs, "iO", &acc_id, &acObj)) 4065 { 4066 return NULL; 4067 } 4068 if (acObj != Py_None) 4069 { 4070 ac = (acc_config_Object *)acObj; 4071 cfg.cred_count = ac->cred_count; 4072 for (i = 0; i < 8; i++) 4073 { 4074 /*cfg.cred_info[i] = ac->cred_info[i];*/ 4075 pjsip_cred_info_Object * ci = (pjsip_cred_info_Object *) 4076 PyList_GetItem((PyObject *)ac->cred_info,i); 4077 cfg.cred_info[i].data.ptr = PyString_AsString(ci->data); 4078 cfg.cred_info[i].data.slen = strlen(PyString_AsString(ci->data)); 4079 cfg.cred_info[i].realm.ptr = PyString_AsString(ci->realm); 4080 cfg.cred_info[i].realm.slen = strlen(PyString_AsString(ci->realm)); 4081 cfg.cred_info[i].scheme.ptr = PyString_AsString(ci->scheme); 4082 cfg.cred_info[i].scheme.slen = strlen 4083 (PyString_AsString(ci->scheme)); 4084 cfg.cred_info[i].username.ptr = PyString_AsString(ci->username); 4085 cfg.cred_info[i].username.slen = strlen 4086 (PyString_AsString(ci->username)); 4087 } 4088 cfg.force_contact.ptr = PyString_AsString(ac->force_contact); 4089 cfg.force_contact.slen = strlen(PyString_AsString(ac->force_contact)); 4090 cfg.id.ptr = PyString_AsString(ac->id); 4091 cfg.id.slen = strlen(PyString_AsString(ac->id)); 4092 cfg.priority = ac->priority; 4093 for (i = 0; i < 8; i++) { 4094 /*cfg.proxy[i] = ac->proxy[i];*/ 4095 cfg.proxy[i].ptr = PyString_AsString 4096 (PyList_GetItem((PyObject *)ac->proxy,i)); 4097 } 4098 cfg.proxy_cnt = ac->proxy_cnt; 4099 cfg.publish_enabled = ac->publish_enabled; 4100 cfg.reg_timeout = ac->reg_timeout; 4101 cfg.reg_uri.ptr = PyString_AsString(ac->reg_uri); 4102 cfg.reg_uri.slen = strlen(PyString_AsString(ac->reg_uri)); 4103 status = pjsua_acc_modify(acc_id, &cfg); 4104 } else { 4105 status = pjsua_acc_modify(acc_id, NULL); 4106 } 4016 4107 return Py_BuildValue("i", status); 4017 4108 } … … 4111 4202 4112 4203 pjsua_acc_id id[PJSUA_MAX_ACC]; 4113 intc, i;4204 unsigned c, i; 4114 4205 if (!PyArg_ParseTuple(pArgs, "")) 4115 4206 { … … 4128 4219 } 4129 4220 4130 4131 4221 return Py_BuildValue("O",list); 4132 4222 } … … 4142 4232 4143 4233 pjsua_acc_info info[PJSUA_MAX_ACC]; 4144 intc, i;4234 unsigned c, i; 4145 4235 if (!PyArg_ParseTuple(pArgs, "")) 4146 4236 { … … 4176 4266 } 4177 4267 4178 4179 4268 return Py_BuildValue("O",list); 4180 4269 } … … 4210 4299 { 4211 4300 int acc_id; 4301 PyObject * tmpObj; 4212 4302 pjsip_rx_data_Object * obj; 4213 4303 pjsip_rx_data * rdata; 4214 4304 4215 if (!PyArg_ParseTuple(pArgs, "O", &obj)) 4216 { 4217 return NULL; 4218 } 4219 4220 rdata = obj->rdata; 4221 acc_id = pjsua_acc_find_for_incoming(rdata); 4222 4305 if (!PyArg_ParseTuple(pArgs, "O", &tmpObj)) 4306 { 4307 return NULL; 4308 } 4309 if (tmpObj != Py_None) 4310 { 4311 obj = (pjsip_rx_data_Object *)tmpObj; 4312 rdata = obj->rdata; 4313 acc_id = pjsua_acc_find_for_incoming(rdata); 4314 } else { 4315 acc_id = pjsua_acc_find_for_incoming(NULL); 4316 } 4223 4317 return Py_BuildValue("i", acc_id); 4224 4318 } … … 4232 4326 { 4233 4327 int status; 4234 int acc_id; 4328 int acc_id; 4329 PyObject * pObj; 4235 4330 pj_pool_Object * p; 4236 4331 pj_pool_t * pool; … … 4240 4335 pj_str_t uri; 4241 4336 4242 if (!PyArg_ParseTuple(pArgs, "OiO", &p, &acc_id, &stru)) 4243 { 4244 return NULL; 4245 } 4246 4247 pool = p->pool; 4248 uri.ptr = PyString_AsString(stru); 4249 uri.slen = strlen(PyString_AsString(stru)); 4250 status = pjsua_acc_create_uac_contact(pool, &contact, acc_id, &uri); 4337 if (!PyArg_ParseTuple(pArgs, "OiO", &pObj, &acc_id, &stru)) 4338 { 4339 return NULL; 4340 } 4341 if (pObj != Py_None) 4342 { 4343 p = (pj_pool_Object *)pObj; 4344 pool = p->pool; 4345 uri.ptr = PyString_AsString(stru); 4346 uri.slen = strlen(PyString_AsString(stru)); 4347 status = pjsua_acc_create_uac_contact(pool, &contact, acc_id, &uri); 4348 } else { 4349 status = pjsua_acc_create_uac_contact(NULL, &contact, acc_id, &uri); 4350 } 4251 4351 strc = PyString_FromStringAndSize(contact.ptr, contact.slen); 4252 4352 … … 4263 4363 int status; 4264 4364 int acc_id; 4365 PyObject * pObj; 4265 4366 pj_pool_Object * p; 4266 4367 pj_pool_t * pool; 4267 4368 PyObject * strc; 4268 4369 pj_str_t contact; 4370 PyObject * rObj; 4269 4371 pjsip_rx_data_Object * objr; 4270 4372 pjsip_rx_data * rdata; 4271 4373 4272 if (!PyArg_ParseTuple(pArgs, "OiO", &p, &acc_id, &objr)) 4273 { 4274 return NULL; 4275 } 4276 4277 pool = p->pool; 4278 4279 rdata = objr->rdata; 4374 if (!PyArg_ParseTuple(pArgs, "OiO", &pObj, &acc_id, &rObj)) 4375 { 4376 return NULL; 4377 } 4378 if (pObj != Py_None) 4379 { 4380 p = (pj_pool_Object *)pObj; 4381 pool = p->pool; 4382 } else { 4383 pool = NULL; 4384 } 4385 if (rObj != Py_None) 4386 { 4387 objr = (pjsip_rx_data_Object *)rObj; 4388 rdata = objr->rdata; 4389 } else { 4390 rdata = NULL; 4391 } 4280 4392 status = pjsua_acc_create_uas_contact(pool, &contact, acc_id, rdata); 4281 4393 strc = PyString_FromStringAndSize(contact.ptr, contact.slen); … … 4684 4796 4685 4797 pjsua_buddy_id id[PJSUA_MAX_BUDDIES]; 4686 intc, i;4798 unsigned c, i; 4687 4799 if (!PyArg_ParseTuple(pArgs, "")) 4688 4800 { 4689 4801 return NULL; 4690 4802 } 4691 4692 4803 c = PJ_ARRAY_SIZE(id); 4693 4804 status = pjsua_enum_buddies(id, &c); 4694 4695 4805 list = PyList_New(c); 4696 4806 for (i = 0; i < c; i++) { … … 4700 4810 } 4701 4811 } 4702 4703 4812 4704 4813 return Py_BuildValue("O",list); … … 4760 4869 static PyObject *py_pjsua_buddy_add 4761 4870 (PyObject *pSelf, PyObject *pArgs) 4762 { 4871 { 4872 PyObject * bcObj; 4763 4873 buddy_config_Object * bc; 4874 4764 4875 pjsua_buddy_config cfg; 4765 4876 … … 4767 4878 int status; 4768 4879 4769 if (!PyArg_ParseTuple(pArgs, "O", &bc)) 4770 { 4771 return NULL; 4772 } 4773 cfg.subscribe = bc->subscribe; 4774 cfg.uri.ptr = PyString_AsString(bc->uri); 4775 cfg.uri.slen = strlen(PyString_AsString(bc->uri)); 4776 4777 status = pjsua_buddy_add(&cfg, &p_buddy_id); 4778 4880 if (!PyArg_ParseTuple(pArgs, "O", &bcObj)) 4881 { 4882 return NULL; 4883 } 4884 if (bcObj != Py_None) 4885 { 4886 bc = (buddy_config_Object *)bcObj; 4887 4888 cfg.subscribe = bc->subscribe; 4889 cfg.uri.ptr = PyString_AsString(bc->uri); 4890 cfg.uri.slen = strlen(PyString_AsString(bc->uri)); 4891 4892 status = pjsua_buddy_add(&cfg, &p_buddy_id); 4893 } else { 4894 status = pjsua_buddy_add(NULL, &p_buddy_id); 4895 } 4779 4896 return Py_BuildValue("ii", status, p_buddy_id); 4780 4897 } … … 4852 4969 PyObject * sc; 4853 4970 pjsua_msg_data msg_data; 4971 PyObject * omdObj; 4854 4972 msg_data_Object * omd; 4855 4973 int user_data; 4856 4974 pj_pool_t *pool; 4857 4975 4858 if (!PyArg_ParseTuple(pArgs, "iOOOOi", &acc_id, &st, &smt, &sc, &omd, &user_data)) 4976 if (!PyArg_ParseTuple(pArgs, "iOOOOi", &acc_id, 4977 &st, &smt, &sc, &omdObj, &user_data)) 4859 4978 { 4860 4979 return NULL; … … 4867 4986 content.ptr = PyString_AsString(sc); 4868 4987 content.slen = strlen(PyString_AsString(sc)); 4869 msg_data.content_type.ptr = PyString_AsString(omd->content_type); 4870 msg_data.content_type.slen = strlen(PyString_AsString(omd->content_type)); 4871 msg_data.msg_body.ptr = PyString_AsString(omd->msg_body); 4872 msg_data.msg_body.slen = strlen(PyString_AsString(omd->msg_body)); 4873 pool = pjsua_pool_create("pjsua", 4000, 4000); 4874 4875 translate_hdr(pool, &msg_data.hdr_list, omd->hdr_list); 4876 status = pjsua_im_send(acc_id, &to, &mime_type, &content, &msg_data, &user_data); 4877 pj_pool_release(pool); 4988 if (omdObj != Py_None) 4989 { 4990 4991 omd = (msg_data_Object *)omdObj; 4992 msg_data.content_type.ptr = PyString_AsString(omd->content_type); 4993 msg_data.content_type.slen = strlen 4994 (PyString_AsString(omd->content_type)); 4995 msg_data.msg_body.ptr = PyString_AsString(omd->msg_body); 4996 msg_data.msg_body.slen = strlen(PyString_AsString(omd->msg_body)); 4997 pool = pjsua_pool_create("pjsua", 4000, 4000); 4998 4999 translate_hdr(pool, &msg_data.hdr_list, omd->hdr_list); 5000 status = pjsua_im_send(acc_id, &to, &mime_type, 5001 &content, &msg_data, &user_data); 5002 pj_pool_release(pool); 5003 } else { 5004 5005 status = pjsua_im_send(acc_id, &to, NULL, 5006 &content, NULL, NULL); 5007 } 5008 4878 5009 return Py_BuildValue("i",status); 4879 5010 } … … 4891 5022 int is_typing; 4892 5023 pjsua_msg_data msg_data; 5024 PyObject * omdObj; 4893 5025 msg_data_Object * omd; 4894 5026 pj_pool_t * pool; 4895 5027 4896 if (!PyArg_ParseTuple(pArgs, "iOiO", &acc_id, &st, &is_typing, &omd ))5028 if (!PyArg_ParseTuple(pArgs, "iOiO", &acc_id, &st, &is_typing, &omdObj)) 4897 5029 { 4898 5030 return NULL; … … 4901 5033 to.ptr = PyString_AsString(st); 4902 5034 to.slen = strlen(PyString_AsString(st)); 4903 msg_data.content_type.ptr = PyString_AsString(omd->content_type); 4904 msg_data.content_type.slen = strlen(PyString_AsString(omd->content_type)); 4905 msg_data.msg_body.ptr = PyString_AsString(omd->msg_body); 4906 msg_data.msg_body.slen = strlen(PyString_AsString(omd->msg_body)); 4907 pool = pjsua_pool_create("pjsua", 4000, 4000); 4908 4909 translate_hdr(pool, &msg_data.hdr_list, omd->hdr_list); 4910 status = pjsua_im_typing(acc_id, &to, is_typing, &msg_data); 4911 pj_pool_release(pool); 5035 if (omdObj != Py_None) 5036 { 5037 omd = (msg_data_Object *)omdObj; 5038 msg_data.content_type.ptr = PyString_AsString(omd->content_type); 5039 msg_data.content_type.slen = strlen 5040 (PyString_AsString(omd->content_type)); 5041 msg_data.msg_body.ptr = PyString_AsString(omd->msg_body); 5042 msg_data.msg_body.slen = strlen(PyString_AsString(omd->msg_body)); 5043 pool = pjsua_pool_create("pjsua", 4000, 4000); 5044 5045 translate_hdr(pool, &msg_data.hdr_list, omd->hdr_list); 5046 status = pjsua_im_typing(acc_id, &to, is_typing, &msg_data); 5047 pj_pool_release(pool); 5048 } else { 5049 status = pjsua_im_typing(acc_id, &to, is_typing, NULL); 5050 } 4912 5051 return Py_BuildValue("i",status); 4913 5052 } … … 5809 5948 5810 5949 pjsua_conf_port_id id[PJSUA_MAX_CONF_PORTS]; 5811 intc, i;5950 unsigned c, i; 5812 5951 if (!PyArg_ParseTuple(pArgs, "")) 5813 5952 { … … 5825 5964 } 5826 5965 } 5827 5828 5966 5829 5967 return Py_BuildValue("O",list); … … 5873 6011 { 5874 6012 int p_id; 6013 PyObject * oportObj; 5875 6014 pjmedia_port_Object * oport; 6015 pjmedia_port * port; 6016 PyObject * opoolObj; 5876 6017 pj_pool_Object * opool; 6018 pj_pool_t * pool; 5877 6019 5878 6020 int status; 5879 6021 5880 6022 5881 if (!PyArg_ParseTuple(pArgs, "OO", &opool, &oport)) 5882 { 5883 return NULL; 5884 } 5885 5886 5887 5888 status = pjsua_conf_add_port(opool->pool, oport->port, &p_id); 6023 if (!PyArg_ParseTuple(pArgs, "OO", &opoolObj, &oportObj)) 6024 { 6025 return NULL; 6026 } 6027 if (opoolObj != Py_None) 6028 { 6029 opool = (pj_pool_Object *)opoolObj; 6030 pool = opool->pool; 6031 } else { 6032 opool = NULL; 6033 pool = NULL; 6034 } 6035 if (oportObj != Py_None) 6036 { 6037 oport = (pjmedia_port_Object *)oportObj; 6038 port = oport->port; 6039 } else { 6040 oport = NULL; 6041 port = NULL; 6042 } 6043 6044 status = pjsua_conf_add_port(pool, port, &p_id); 5889 6045 5890 6046 … … 6062 6218 6063 6219 6064 if (!PyArg_ParseTuple(pArgs, "OiOii", &filename, &enc_type, &enc_param, &max_size, &options)) 6220 if (!PyArg_ParseTuple(pArgs, "OiOii", &filename, 6221 &enc_type, &enc_param, &max_size, &options)) 6065 6222 { 6066 6223 return NULL; … … 6070 6227 strparam.ptr = PyString_AsString(enc_param); 6071 6228 strparam.slen = strlen(PyString_AsString(enc_param)); 6072 status = pjsua_recorder_create(&str, enc_type, NULL, max_size, options, &p_id); 6229 status = pjsua_recorder_create 6230 (&str, enc_type, NULL, max_size, options, &p_id); 6073 6231 6074 6232 return Py_BuildValue("ii", status, p_id); … … 6126 6284 6127 6285 pjmedia_snd_dev_info info[64]; 6128 intc, i;6286 unsigned c, i; 6129 6287 if (!PyArg_ParseTuple(pArgs, "")) 6130 6288 { … … 6161 6319 } 6162 6320 6163 6164 6321 return Py_BuildValue("O",list); 6165 6322 } … … 6278 6435 6279 6436 int status; 6280 intp_tail_ms;6437 unsigned p_tail_ms; 6281 6438 6282 6439 if (!PyArg_ParseTuple(pArgs, "")) … … 6301 6458 6302 6459 pjsua_codec_info info[PJMEDIA_CODEC_MGR_MAX_CODECS]; 6303 intc, i;6460 unsigned c, i; 6304 6461 if (!PyArg_ParseTuple(pArgs, "")) 6305 6462 { … … 6330 6487 } 6331 6488 6332 6489 6333 6490 return Py_BuildValue("O",list); 6334 6491 } … … 6409 6566 pj_str_t str; 6410 6567 pjmedia_codec_param param; 6568 PyObject * tmpObj; 6411 6569 pjmedia_codec_param_Object *obj; 6412 6570 6413 6571 6414 if (!PyArg_ParseTuple(pArgs, "OO", &id, & obj))6572 if (!PyArg_ParseTuple(pArgs, "OO", &id, &tmpObj)) 6415 6573 { 6416 6574 return NULL; 6417 6575 } 6576 6418 6577 str.ptr = PyString_AsString(id); 6419 6578 str.slen = strlen(PyString_AsString(id)); 6420 param.info.avg_bps = obj->info->avg_bps; 6421 param.info.channel_cnt = obj->info->channel_cnt; 6422 param.info.clock_rate = obj->info->clock_rate; 6423 param.info.frm_ptime = obj->info->frm_ptime; 6424 param.info.pcm_bits_per_sample = obj->info->pcm_bits_per_sample; 6425 param.info.pt = obj->info->pt; 6426 param.setting.cng = obj->setting->cng; 6427 param.setting.dec_fmtp_mode = obj->setting->dec_fmtp_mode; 6428 param.setting.enc_fmtp_mode = obj->setting->enc_fmtp_mode; 6429 param.setting.frm_per_pkt = obj->setting->frm_per_pkt; 6430 param.setting.penh = obj->setting->penh; 6431 param.setting.plc = obj->setting->plc; 6432 param.setting.reserved = obj->setting->reserved; 6433 param.setting.vad = obj->setting->vad; 6434 status = pjsua_codec_set_param(&str, ¶m); 6435 6579 if (tmpObj != Py_None) 6580 { 6581 obj = (pjmedia_codec_param_Object *)tmpObj; 6582 param.info.avg_bps = obj->info->avg_bps; 6583 param.info.channel_cnt = obj->info->channel_cnt; 6584 param.info.clock_rate = obj->info->clock_rate; 6585 param.info.frm_ptime = obj->info->frm_ptime; 6586 param.info.pcm_bits_per_sample = obj->info->pcm_bits_per_sample; 6587 param.info.pt = obj->info->pt; 6588 param.setting.cng = obj->setting->cng; 6589 param.setting.dec_fmtp_mode = obj->setting->dec_fmtp_mode; 6590 param.setting.enc_fmtp_mode = obj->setting->enc_fmtp_mode; 6591 param.setting.frm_per_pkt = obj->setting->frm_per_pkt; 6592 param.setting.penh = obj->setting->penh; 6593 param.setting.plc = obj->setting->plc; 6594 param.setting.reserved = obj->setting->reserved; 6595 param.setting.vad = obj->setting->vad; 6596 status = pjsua_codec_set_param(&str, ¶m); 6597 } else { 6598 status = pjsua_codec_set_param(&str, NULL); 6599 } 6436 6600 return Py_BuildValue("i", status); 6437 6601 } … … 6840 7004 "connect_duration", T_OBJECT_EX, 6841 7005 offsetof(call_info_Object, connect_duration), 0, 6842 "Up-to-date call connected duration 7006 "Up-to-date call connected duration(zero when call is not established)" 6843 7007 }, 6844 7008 { … … 6950 7114 6951 7115 pjsua_transport_id id[PJSUA_MAX_CALLS]; 6952 intc, i;7116 unsigned c, i; 6953 7117 if (!PyArg_ParseTuple(pArgs, "")) 6954 7118 { … … 6968 7132 } 6969 7133 } 6970 6971 7134 6972 7135 return Py_BuildValue("O",list); … … 6985 7148 unsigned options; 6986 7149 pjsua_msg_data msg_data; 7150 PyObject * omdObj; 6987 7151 msg_data_Object * omd; 6988 7152 int user_data; … … 6990 7154 pj_pool_t * pool; 6991 7155 6992 if (!PyArg_ParseTuple(pArgs, "iOIiO", &acc_id, &sd, &options, &user_data, &omd)) 7156 if (!PyArg_ParseTuple 7157 (pArgs, "iOIiO", &acc_id, &sd, &options, &user_data, &omdObj)) 6993 7158 { 6994 7159 return NULL; … … 6997 7162 dst_uri.ptr = PyString_AsString(sd); 6998 7163 dst_uri.slen = strlen(PyString_AsString(sd)); 6999 7000 msg_data.content_type.ptr = PyString_AsString(omd->content_type); 7001 msg_data.content_type.slen = strlen(PyString_AsString(omd->content_type)); 7002 msg_data.msg_body.ptr = PyString_AsString(omd->msg_body); 7003 msg_data.msg_body.slen = strlen(PyString_AsString(omd->msg_body)); 7004 pool = pjsua_pool_create("pjsua", 4000, 4000); 7005 translate_hdr(pool, &msg_data.hdr_list, omd->hdr_list); 7006 status = pjsua_call_make_call(acc_id, &dst_uri, options, &user_data, &msg_data, &call_id); 7007 pj_pool_release(pool); 7164 if (omdObj != Py_None) { 7165 omd = (msg_data_Object *)omdObj; 7166 msg_data.content_type.ptr = PyString_AsString(omd->content_type); 7167 msg_data.content_type.slen = strlen 7168 (PyString_AsString(omd->content_type)); 7169 msg_data.msg_body.ptr = PyString_AsString(omd->msg_body); 7170 msg_data.msg_body.slen = strlen(PyString_AsString(omd->msg_body)); 7171 pool = pjsua_pool_create("pjsua", 4000, 4000); 7172 translate_hdr(pool, &msg_data.hdr_list, omd->hdr_list); 7173 status = pjsua_call_make_call(acc_id, &dst_uri, 7174 options, &user_data, &msg_data, &call_id); 7175 pj_pool_release(pool); 7176 } else { 7177 status = pjsua_call_make_call(acc_id, &dst_uri, 7178 options, &user_data, NULL, &call_id); 7179 } 7008 7180 return Py_BuildValue("ii",status, call_id); 7009 7181 } … … 7192 7364 unsigned code; 7193 7365 pjsua_msg_data msg_data; 7366 PyObject * omdObj; 7194 7367 msg_data_Object * omd; 7195 7368 pj_pool_t * pool; 7196 7369 7197 if (!PyArg_ParseTuple(pArgs, "iIOO", &call_id, &code, &sr, &omd ))7370 if (!PyArg_ParseTuple(pArgs, "iIOO", &call_id, &code, &sr, &omdObj)) 7198 7371 { 7199 7372 return NULL; … … 7202 7375 reason.ptr = PyString_AsString(sr); 7203 7376 reason.slen = strlen(PyString_AsString(sr)); 7204 7205 msg_data.content_type.ptr = PyString_AsString(omd->content_type); 7206 msg_data.content_type.slen = strlen(PyString_AsString(omd->content_type)); 7207 msg_data.msg_body.ptr = PyString_AsString(omd->msg_body); 7208 msg_data.msg_body.slen = strlen(PyString_AsString(omd->msg_body)); 7209 pool = pjsua_pool_create("pjsua", 4000, 4000); 7210 translate_hdr(pool, &msg_data.hdr_list, omd->hdr_list); 7211 status = pjsua_call_answer(call_id, code, &reason, &msg_data); 7212 7213 pj_pool_release(pool); 7377 if (omdObj != Py_None) { 7378 omd = (msg_data_Object *)omdObj; 7379 msg_data.content_type.ptr = PyString_AsString(omd->content_type); 7380 msg_data.content_type.slen = strlen 7381 (PyString_AsString(omd->content_type)); 7382 msg_data.msg_body.ptr = PyString_AsString(omd->msg_body); 7383 msg_data.msg_body.slen = strlen(PyString_AsString(omd->msg_body)); 7384 pool = pjsua_pool_create("pjsua", 4000, 4000); 7385 translate_hdr(pool, &msg_data.hdr_list, omd->hdr_list); 7386 7387 status = pjsua_call_answer(call_id, code, &reason, &msg_data); 7388 7389 pj_pool_release(pool); 7390 } else { 7391 7392 status = pjsua_call_answer(call_id, code, &reason, NULL); 7393 } 7214 7394 return Py_BuildValue("i",status); 7215 7395 } … … 7227 7407 unsigned code; 7228 7408 pjsua_msg_data msg_data; 7409 PyObject * omdObj; 7229 7410 msg_data_Object * omd; 7230 7411 pj_pool_t * pool; 7231 7412 7232 if (!PyArg_ParseTuple(pArgs, "iIOO", &call_id, &code, &sr, &omd ))7413 if (!PyArg_ParseTuple(pArgs, "iIOO", &call_id, &code, &sr, &omdObj)) 7233 7414 { 7234 7415 return NULL; … … 7237 7418 reason.ptr = PyString_AsString(sr); 7238 7419 reason.slen = strlen(PyString_AsString(sr)); 7239 7240 msg_data.content_type.ptr = PyString_AsString(omd->content_type); 7241 msg_data.content_type.slen = strlen(PyString_AsString(omd->content_type)); 7242 msg_data.msg_body.ptr = PyString_AsString(omd->msg_body); 7243 msg_data.msg_body.slen = strlen(PyString_AsString(omd->msg_body)); 7244 pool = pjsua_pool_create("pjsua", 4000, 4000); 7245 translate_hdr(pool, &msg_data.hdr_list, omd->hdr_list); 7246 status = pjsua_call_hangup(call_id, code, &reason, &msg_data); 7247 pj_pool_release(pool); 7420 if (omdObj != Py_None) { 7421 omd = (msg_data_Object *)omdObj; 7422 msg_data.content_type.ptr = PyString_AsString(omd->content_type); 7423 msg_data.content_type.slen = strlen 7424 (PyString_AsString(omd->content_type)); 7425 msg_data.msg_body.ptr = PyString_AsString(omd->msg_body); 7426 msg_data.msg_body.slen = strlen(PyString_AsString(omd->msg_body)); 7427 pool = pjsua_pool_create("pjsua", 4000, 4000); 7428 translate_hdr(pool, &msg_data.hdr_list, omd->hdr_list); 7429 status = pjsua_call_hangup(call_id, code, &reason, &msg_data); 7430 pj_pool_release(pool); 7431 } else { 7432 status = pjsua_call_hangup(call_id, code, &reason, NULL); 7433 } 7248 7434 return Py_BuildValue("i",status); 7249 7435 } … … 7258 7444 int call_id; 7259 7445 pjsua_msg_data msg_data; 7446 PyObject * omdObj; 7260 7447 msg_data_Object * omd; 7261 7448 pj_pool_t * pool; 7262 7449 7263 if (!PyArg_ParseTuple(pArgs, "iO", &call_id, &omd)) 7264 { 7265 return NULL; 7266 } 7267 7268 msg_data.content_type.ptr = PyString_AsString(omd->content_type); 7269 msg_data.content_type.slen = strlen(PyString_AsString(omd->content_type)); 7270 msg_data.msg_body.ptr = PyString_AsString(omd->msg_body); 7271 msg_data.msg_body.slen = strlen(PyString_AsString(omd->msg_body)); 7272 pool = pjsua_pool_create("pjsua", 4000, 4000); 7273 translate_hdr(pool, &msg_data.hdr_list, omd->hdr_list); 7274 status = pjsua_call_set_hold(call_id, &msg_data); 7275 pj_pool_release(pool); 7450 if (!PyArg_ParseTuple(pArgs, "iO", &call_id, &omdObj)) 7451 { 7452 return NULL; 7453 } 7454 7455 if (omdObj != Py_None) { 7456 omd = (msg_data_Object *)omdObj; 7457 msg_data.content_type.ptr = PyString_AsString(omd->content_type); 7458 msg_data.content_type.slen = strlen 7459 (PyString_AsString(omd->content_type)); 7460 msg_data.msg_body.ptr = PyString_AsString(omd->msg_body); 7461 msg_data.msg_body.slen = strlen(PyString_AsString(omd->msg_body)); 7462 pool = pjsua_pool_create("pjsua", 4000, 4000); 7463 translate_hdr(pool, &msg_data.hdr_list, omd->hdr_list); 7464 status = pjsua_call_set_hold(call_id, &msg_data); 7465 pj_pool_release(pool); 7466 } else { 7467 status = pjsua_call_set_hold(call_id, NULL); 7468 } 7276 7469 return Py_BuildValue("i",status); 7277 7470 } … … 7287 7480 int unhold; 7288 7481 pjsua_msg_data msg_data; 7482 PyObject * omdObj; 7289 7483 msg_data_Object * omd; 7290 7484 pj_pool_t * pool; 7291 7485 7292 if (!PyArg_ParseTuple(pArgs, "iiO", &call_id, &unhold, &omd)) 7293 { 7294 return NULL; 7295 } 7296 7297 msg_data.content_type.ptr = PyString_AsString(omd->content_type); 7298 msg_data.content_type.slen = strlen(PyString_AsString(omd->content_type)); 7299 msg_data.msg_body.ptr = PyString_AsString(omd->msg_body); 7300 msg_data.msg_body.slen = strlen(PyString_AsString(omd->msg_body)); 7301 pool = pjsua_pool_create("pjsua", 4000, 4000); 7302 translate_hdr(pool, &msg_data.hdr_list, omd->hdr_list); 7303 status = pjsua_call_reinvite(call_id, unhold, &msg_data); 7304 pj_pool_release(pool); 7486 if (!PyArg_ParseTuple(pArgs, "iiO", &call_id, &unhold, &omdObj)) 7487 { 7488 return NULL; 7489 } 7490 7491 if (omdObj != Py_None) 7492 { 7493 omd = (msg_data_Object *)omdObj; 7494 msg_data.content_type.ptr = PyString_AsString(omd->content_type); 7495 msg_data.content_type.slen = strlen 7496 (PyString_AsString(omd->content_type)); 7497 msg_data.msg_body.ptr = PyString_AsString(omd->msg_body); 7498 msg_data.msg_body.slen = strlen(PyString_AsString(omd->msg_body)); 7499 pool = pjsua_pool_create("pjsua", 4000, 4000); 7500 translate_hdr(pool, &msg_data.hdr_list, omd->hdr_list); 7501 status = pjsua_call_reinvite(call_id, unhold, &msg_data); 7502 pj_pool_release(pool); 7503 } else { 7504 status = pjsua_call_reinvite(call_id, unhold, NULL); 7505 } 7305 7506 return Py_BuildValue("i",status); 7306 7507 } … … 7317 7518 PyObject * sd; 7318 7519 pjsua_msg_data msg_data; 7520 PyObject * omdObj; 7319 7521 msg_data_Object * omd; 7320 7522 pj_pool_t * pool; 7321 7523 7322 if (!PyArg_ParseTuple(pArgs, "iOO", &call_id, &sd, &omd ))7524 if (!PyArg_ParseTuple(pArgs, "iOO", &call_id, &sd, &omdObj)) 7323 7525 { 7324 7526 return NULL; … … 7328 7530 dest.slen = strlen(PyString_AsString(sd)); 7329 7531 7330 msg_data.content_type.ptr = PyString_AsString(omd->content_type); 7331 msg_data.content_type.slen = strlen(PyString_AsString(omd->content_type)); 7332 msg_data.msg_body.ptr = PyString_AsString(omd->msg_body); 7333 msg_data.msg_body.slen = strlen(PyString_AsString(omd->msg_body)); 7334 pool = pjsua_pool_create("pjsua", 4000, 4000); 7335 translate_hdr(pool, &msg_data.hdr_list, omd->hdr_list); 7336 status = pjsua_call_xfer(call_id, &dest, &msg_data); 7337 pj_pool_release(pool); 7532 if (omdObj != Py_None) 7533 { 7534 omd = (msg_data_Object *)omdObj; 7535 msg_data.content_type.ptr = PyString_AsString(omd->content_type); 7536 msg_data.content_type.slen = strlen 7537 (PyString_AsString(omd->content_type)); 7538 msg_data.msg_body.ptr = PyString_AsString(omd->msg_body); 7539 msg_data.msg_body.slen = strlen(PyString_AsString(omd->msg_body)); 7540 pool = pjsua_pool_create("pjsua", 4000, 4000); 7541 translate_hdr(pool, &msg_data.hdr_list, omd->hdr_list); 7542 status = pjsua_call_xfer(call_id, &dest, &msg_data); 7543 pj_pool_release(pool); 7544 } else { 7545 status = pjsua_call_xfer(call_id, &dest, NULL); 7546 } 7338 7547 return Py_BuildValue("i",status); 7339 7548 } … … 7350 7559 unsigned options; 7351 7560 pjsua_msg_data msg_data; 7561 PyObject * omdObj; 7352 7562 msg_data_Object * omd; 7353 7563 pj_pool_t * pool; 7354 7564 7355 if (!PyArg_ParseTuple(pArgs, "iiIO", &call_id, &dest_call_id, &options, &omd)) 7565 if (!PyArg_ParseTuple 7566 (pArgs, "iiIO", &call_id, &dest_call_id, &options, &omdObj)) 7356 7567 { 7357 7568 return NULL; 7358 7569 } 7359 7570 7360 7361 msg_data.content_type.ptr = PyString_AsString(omd->content_type); 7362 msg_data.content_type.slen = strlen(PyString_AsString(omd->content_type)); 7363 msg_data.msg_body.ptr = PyString_AsString(omd->msg_body); 7364 msg_data.msg_body.slen = strlen(PyString_AsString(omd->msg_body)); 7365 pool = pjsua_pool_create("pjsua", 4000, 4000); 7366 translate_hdr(pool, &msg_data.hdr_list, omd->hdr_list); 7367 status = pjsua_call_xfer_replaces(call_id, dest_call_id, options, &msg_data); 7368 pj_pool_release(pool); 7571 if (omdObj != Py_None) 7572 { 7573 omd = (msg_data_Object *)omdObj; 7574 msg_data.content_type.ptr = PyString_AsString(omd->content_type); 7575 msg_data.content_type.slen = strlen 7576 (PyString_AsString(omd->content_type)); 7577 msg_data.msg_body.ptr = PyString_AsString(omd->msg_body); 7578 msg_data.msg_body.slen = strlen(PyString_AsString(omd->msg_body)); 7579 pool = pjsua_pool_create("pjsua", 4000, 4000); 7580 translate_hdr(pool, &msg_data.hdr_list, omd->hdr_list); 7581 status = pjsua_call_xfer_replaces 7582 (call_id, dest_call_id, options, &msg_data); 7583 pj_pool_release(pool); 7584 } else { 7585 status = pjsua_call_xfer_replaces(call_id, dest_call_id,options, NULL); 7586 } 7369 7587 return Py_BuildValue("i",status); 7370 7588 } … … 7404 7622 PyObject * sc; 7405 7623 pjsua_msg_data msg_data; 7624 PyObject * omdObj; 7406 7625 msg_data_Object * omd; 7407 7626 int user_data; 7408 7627 pj_pool_t * pool; 7409 7628 7410 if (!PyArg_ParseTuple(pArgs, "iOOOi", &call_id, &sm, &sc, &omd, &user_data)) 7629 if (!PyArg_ParseTuple 7630 (pArgs, "iOOOi", &call_id, &sm, &sc, &omdObj, &user_data)) 7411 7631 { 7412 7632 return NULL; … … 7418 7638 content.slen = strlen(PyString_AsString(sc)); 7419 7639 7420 msg_data.content_type.ptr = PyString_AsString(omd->content_type); 7421 msg_data.content_type.slen = strlen(PyString_AsString(omd->content_type)); 7422 msg_data.msg_body.ptr = PyString_AsString(omd->msg_body); 7423 msg_data.msg_body.slen = strlen(PyString_AsString(omd->msg_body)); 7424 pool = pjsua_pool_create("pjsua", 4000, 4000); 7425 translate_hdr(pool, &msg_data.hdr_list, omd->hdr_list); 7426 status = pjsua_call_send_im(call_id, &mime_type, &content, &msg_data, &user_data); 7427 pj_pool_release(pool); 7640 if (omdObj != Py_None) 7641 { 7642 omd = (msg_data_Object *)omdObj; 7643 msg_data.content_type.ptr = PyString_AsString(omd->content_type); 7644 msg_data.content_type.slen = strlen 7645 (PyString_AsString(omd->content_type)); 7646 msg_data.msg_body.ptr = PyString_AsString(omd->msg_body); 7647 msg_data.msg_body.slen = strlen(PyString_AsString(omd->msg_body)); 7648 pool = pjsua_pool_create("pjsua", 4000, 4000); 7649 translate_hdr(pool, &msg_data.hdr_list, omd->hdr_list); 7650 status = pjsua_call_send_im 7651 (call_id, &mime_type, &content, &msg_data, &user_data); 7652 pj_pool_release(pool); 7653 } else { 7654 status = pjsua_call_send_im 7655 (call_id, &mime_type, &content, NULL, &user_data); 7656 } 7428 7657 return Py_BuildValue("i",status); 7429 7658 } … … 7439 7668 int is_typing; 7440 7669 pjsua_msg_data msg_data; 7670 PyObject * omdObj; 7441 7671 msg_data_Object * omd; 7442 7672 pj_pool_t * pool; 7443 7673 7444 if (!PyArg_ParseTuple(pArgs, "iiO", &call_id, &is_typing, &omd ))7674 if (!PyArg_ParseTuple(pArgs, "iiO", &call_id, &is_typing, &omdObj)) 7445 7675 { 7446 7676 return NULL; 7447 7677 } 7448 7678 7449 msg_data.content_type.ptr = PyString_AsString(omd->content_type); 7450 msg_data.content_type.slen = strlen(PyString_AsString(omd->content_type)); 7451 msg_data.msg_body.ptr = PyString_AsString(omd->msg_body); 7452 msg_data.msg_body.slen = strlen(PyString_AsString(omd->msg_body)); 7453 pool = pjsua_pool_create("pjsua", 4000, 4000); 7454 translate_hdr(pool, &msg_data.hdr_list, omd->hdr_list); 7455 status = pjsua_call_send_typing_ind(call_id, is_typing, &msg_data); 7456 pj_pool_release(pool); 7679 if (omdObj != Py_None) 7680 { 7681 omd = (msg_data_Object *)omdObj; 7682 msg_data.content_type.ptr = PyString_AsString(omd->content_type); 7683 msg_data.content_type.slen = strlen 7684 (PyString_AsString(omd->content_type)); 7685 msg_data.msg_body.ptr = PyString_AsString(omd->msg_body); 7686 msg_data.msg_body.slen = strlen(PyString_AsString(omd->msg_body)); 7687 pool = pjsua_pool_create("pjsua", 4000, 4000); 7688 translate_hdr(pool, &msg_data.hdr_list, omd->hdr_list); 7689 status = pjsua_call_send_typing_ind(call_id, is_typing, &msg_data); 7690 pj_pool_release(pool); 7691 } else { 7692 status = pjsua_call_send_typing_ind(call_id, is_typing, NULL); 7693 } 7457 7694 return Py_BuildValue("i",status); 7458 7695 } … … 7585 7822 /* END OF LIB CALL */ 7586 7823 7587 /* For testing purpose only */7588 7589 struct call_data7590 {7591 pj_timer_entry timer;7592 };7593 7594 /*7595 * call_data_Object7596 */7597 typedef struct7598 {7599 PyObject_HEAD7600 /* Type-specific fields go here. */7601 struct call_data * data;7602 } call_data_Object;7603 7604 7605 /*7606 * call_data_Type7607 */7608 static PyTypeObject call_data_Type =7609 {7610 PyObject_HEAD_INIT(NULL)7611 0, /*ob_size*/7612 "py_pjsua.Call_Data", /*tp_name*/7613 sizeof(call_data_Object), /*tp_basicsize*/7614 0, /*tp_itemsize*/7615 0, /*tp_dealloc*/7616 0, /*tp_print*/7617 0, /*tp_getattr*/7618 0, /*tp_setattr*/7619 0, /*tp_compare*/7620 0, /*tp_repr*/7621 0, /*tp_as_number*/7622 0, /*tp_as_sequence*/7623 0, /*tp_as_mapping*/7624 0, /*tp_hash */7625 0, /*tp_call*/7626 0, /*tp_str*/7627 0, /*tp_getattro*/7628 0, /*tp_setattro*/7629 0, /*tp_as_buffer*/7630 Py_TPFLAGS_DEFAULT, /*tp_flags*/7631 "call_data objects", /*tp_doc*/7632 };7633 7634 static void call_timeout_callback(pj_timer_heap_t *timer_heap,7635 struct pj_timer_entry *entry, unsigned duration)7636 {7637 pjsua_call_id call_id = entry->id;7638 pjsua_msg_data msg_data;7639 pjsip_generic_string_hdr warn;7640 pj_str_t hname = pj_str("Warning");7641 pj_str_t hvalue = pj_str("399 pjsua \"Call duration exceeded\"");7642 7643 PJ_UNUSED_ARG(timer_heap);7644 7645 if (call_id == PJSUA_INVALID_ID) {7646 PJ_LOG(1,(THIS_FILE, "Invalid call ID in timer callback"));7647 return;7648 }7649 7650 /* Add warning header */7651 pjsua_msg_data_init(&msg_data);7652 pjsip_generic_string_hdr_init2(&warn, &hname, &hvalue);7653 pj_list_push_back(&msg_data.hdr_list, &warn);7654 7655 /* Call duration has been exceeded; disconnect the call */7656 PJ_LOG(3,(THIS_FILE, "Duration (%d seconds) has been exceeded "7657 "for call %d, disconnecting the call",7658 duration, call_id));7659 entry->id = PJSUA_INVALID_ID;7660 pjsua_call_hangup(call_id, 200, NULL, &msg_data);7661 }7662 7663 /*static PyObject *py_pjsua_call_timeout_callback7664 (PyObject *pSelf, PyObject *pArgs)7665 {7666 7667 if (!PyArg_ParseTuple(pArgs, ""))7668 {7669 return NULL;7670 }7671 7672 call_timeout_callback();7673 7674 Py_INCREF(Py_None);7675 return Py_None;7676 }*/7677 7678 static void on_call_state_1() {7679 /* if app_config.call_data[call_id].timer.id != PJSUA_INVALID_ID) {7680 struct call_data *cd = &app_config.call_data[call_id];7681 pjsip_endpoint *endpt = pjsua_get_pjsip_endpt();7682 7683 cd->timer.id = PJSUA_INVALID_ID;7684 pjsip_endpt_cancel_timer(endpt, &cd->timer);7685 }7686 7687 PJ_LOG(3,(THIS_FILE, "Call %d is DISCONNECTED [reason=%d (%s)]",7688 call_id,7689 call_info.last_status,7690 call_info.last_status_text.ptr));*/7691 }7692 7693 /* END OF Testing section */7694 7695 7824 /* 7696 7825 * Map of function names to functions
Note: See TracChangeset
for help on using the changeset viewer.