From 78b3a41d1e054c7cd2f29ff66b3aef258ab87010 Mon Sep 17 00:00:00 2001 From: Nanang Izzuddin Date: Tue, 4 Aug 2009 14:36:17 +0000 Subject: Ticket #930: - Changed semantic of pjsua_acc_config.contact_params, it is now used for specifying Contact header parameters (it was used for specifying Contact URI parameters). - Added a new field pjsua_acc_config.contact_uri_params, for specifying Contact URI parameters. - Added fields pjsua_acc_config.contact_params and pjsua_acc_config.contact_uri_params into python pjsua. - Updated/added option in pjsua app to specify Contact header parameters and Contact URI parameters. git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2852 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip-apps/src/pjsua/pjsua_app.c | 20 +++++++++++++++++--- pjsip-apps/src/python/_pjsua.h | 22 ++++++++++++++++++++++ 2 files changed, 39 insertions(+), 3 deletions(-) (limited to 'pjsip-apps/src') diff --git a/pjsip-apps/src/pjsua/pjsua_app.c b/pjsip-apps/src/pjsua/pjsua_app.c index 4f534f90..41630132 100644 --- a/pjsip-apps/src/pjsua/pjsua_app.c +++ b/pjsip-apps/src/pjsua/pjsua_app.c @@ -180,7 +180,8 @@ static void usage(void) puts (" --registrar=url Set the URL of registrar server"); puts (" --id=url Set the URL of local ID (used in From header)"); puts (" --contact=url Optionally override the Contact information"); - puts (" --contact-params=S Append the specified parameters S in Contact URI"); + puts (" --contact-params=S Append the specified parameters S in Contact header"); + puts (" --contact-uri-params=S Append the specified parameters S in Contact URI"); puts (" --proxy=url Optional URL of proxy server to visit"); puts (" May be specified multiple times"); puts (" --reg-timeout=SEC Optional registration interval (default 55)"); @@ -471,7 +472,7 @@ static pj_status_t parse_args(int argc, char *argv[], OPT_HELP, OPT_VERSION, OPT_NULL_AUDIO, OPT_SND_AUTO_CLOSE, OPT_LOCAL_PORT, OPT_IP_ADDR, OPT_PROXY, OPT_OUTBOUND_PROXY, OPT_REGISTRAR, OPT_REG_TIMEOUT, OPT_PUBLISH, OPT_ID, OPT_CONTACT, - OPT_BOUND_ADDR, OPT_CONTACT_PARAMS, + OPT_BOUND_ADDR, OPT_CONTACT_PARAMS, OPT_CONTACT_URI_PARAMS, OPT_100REL, OPT_USE_IMS, OPT_REALM, OPT_USERNAME, OPT_PASSWORD, OPT_NAMESERVER, OPT_STUN_DOMAIN, OPT_STUN_SRV, OPT_ADD_BUDDY, OPT_OFFER_X_MS_MSG, OPT_NO_PRESENCE, @@ -529,6 +530,7 @@ static pj_status_t parse_args(int argc, char *argv[], { "id", 1, 0, OPT_ID}, { "contact", 1, 0, OPT_CONTACT}, { "contact-params",1,0, OPT_CONTACT_PARAMS}, + { "contact-uri-params",1,0, OPT_CONTACT_URI_PARAMS}, { "auto-update-nat", 1, 0, OPT_AUTO_UPDATE_NAT}, { "use-compact-form", 0, 0, OPT_USE_COMPACT_FORM}, { "accept-redirect", 1, 0, OPT_ACCEPT_REDIRECT}, @@ -851,6 +853,10 @@ static pj_status_t parse_args(int argc, char *argv[], cur_acc->contact_params = pj_str(pj_optarg); break; + case OPT_CONTACT_URI_PARAMS: + cur_acc->contact_uri_params = pj_str(pj_optarg); + break; + case OPT_AUTO_UPDATE_NAT: /* OPT_AUTO_UPDATE_NAT */ cur_acc->allow_contact_rewrite = pj_strtoul(pj_cstr(&tmp, pj_optarg)); break; @@ -1405,7 +1411,7 @@ static void write_account_settings(int acc_index, pj_str_t *result) pj_strcat2(result, line); } - /* Contact parameters */ + /* Contact header parameters */ if (acc_cfg->contact_params.slen) { pj_ansi_sprintf(line, "--contact-params %.*s\n", (int)acc_cfg->contact_params.slen, @@ -1413,6 +1419,14 @@ static void write_account_settings(int acc_index, pj_str_t *result) pj_strcat2(result, line); } + /* Contact URI parameters */ + if (acc_cfg->contact_uri_params.slen) { + pj_ansi_sprintf(line, "--contact-uri-params %.*s\n", + (int)acc_cfg->contact_uri_params.slen, + acc_cfg->contact_uri_params.ptr); + pj_strcat2(result, line); + } + /* */ if (acc_cfg->allow_contact_rewrite!=1) { diff --git a/pjsip-apps/src/python/_pjsua.h b/pjsip-apps/src/python/_pjsua.h index e277c7d0..d3958d76 100644 --- a/pjsip-apps/src/python/_pjsua.h +++ b/pjsip-apps/src/python/_pjsua.h @@ -1653,6 +1653,8 @@ typedef struct int auth_initial_send; PyObject *auth_initial_algorithm; PyObject *pidf_tuple_id; + PyObject *contact_params; + PyObject *contact_uri_params; int require_100rel; int allow_contact_rewrite; int ka_interval; @@ -1675,6 +1677,8 @@ static void PyObj_pjsua_acc_config_delete(PyObj_pjsua_acc_config* self) Py_XDECREF(self->cred_info); Py_XDECREF(self->auth_initial_algorithm); Py_XDECREF(self->pidf_tuple_id); + Py_XDECREF(self->contact_params); + Py_XDECREF(self->contact_uri_params); Py_XDECREF(self->ka_data); self->ob_type->tp_free((PyObject*)self); } @@ -1721,6 +1725,10 @@ static void PyObj_pjsua_acc_config_import(PyObj_pjsua_acc_config *obj, obj->auth_initial_algorithm = PyString_FromPJ(&cfg->auth_pref.algorithm); Py_XDECREF(obj->pidf_tuple_id); obj->pidf_tuple_id = PyString_FromPJ(&cfg->pidf_tuple_id); + Py_XDECREF(obj->contact_params); + obj->contact_params = PyString_FromPJ(&cfg->contact_params); + Py_XDECREF(obj->contact_uri_params); + obj->contact_uri_params = PyString_FromPJ(&cfg->contact_uri_params); obj->require_100rel = cfg->require_100rel; obj->allow_contact_rewrite = cfg->allow_contact_rewrite; obj->ka_interval = cfg->ka_interval; @@ -1765,6 +1773,8 @@ static void PyObj_pjsua_acc_config_export(pjsua_acc_config *cfg, cfg->auth_pref.initial_auth = obj->auth_initial_send; cfg->auth_pref.algorithm = PyString_ToPJ(obj->auth_initial_algorithm); cfg->pidf_tuple_id = PyString_ToPJ(obj->pidf_tuple_id); + cfg->contact_params = PyString_ToPJ(obj->contact_params); + cfg->contact_uri_params = PyString_ToPJ(obj->contact_uri_params); cfg->require_100rel = obj->require_100rel; cfg->allow_contact_rewrite = obj->allow_contact_rewrite; cfg->ka_interval = obj->ka_interval; @@ -1796,6 +1806,8 @@ static PyObject * PyObj_pjsua_acc_config_new(PyTypeObject *type, self->cred_info = (PyListObject *)PyList_New(0); self->auth_initial_algorithm = PyString_FromString(""); self->pidf_tuple_id = PyString_FromString(""); + self->contact_params = PyString_FromString(""); + self->contact_uri_params = PyString_FromString(""); self->ka_data = PyString_FromString(""); } @@ -1893,6 +1905,16 @@ static PyMemberDef PyObj_pjsua_acc_config_members[] = offsetof(PyObj_pjsua_acc_config, pidf_tuple_id), 0, "PIDF tuple id." }, + { + "contact_params", T_OBJECT_EX, + offsetof(PyObj_pjsua_acc_config, contact_params), 0, + "Additional parameters for Contact header." + }, + { + "contact_uri_params", T_OBJECT_EX, + offsetof(PyObj_pjsua_acc_config, contact_uri_params), 0, + "Additional parameters for Contact URI." + }, { "require_100rel", T_INT, offsetof(PyObj_pjsua_acc_config, require_100rel), 0, -- cgit v1.2.3