[asterisk-scf-commits] asterisk-scf/integration/pjproject.git branch "extend-pjsua-python" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Mon Dec 12 15:28:30 CST 2011


branch "extend-pjsua-python" has been updated
       via  45a3b9fa96c72d42a83fba2fdc5043c40198c17b (commit)
       via  d359a6146154116c841bb5d2ba8935d94abfbefd (commit)
      from  e249cf8575b8914990bf20d62df375f774f83df2 (commit)

Summary of changes:
 pjsip-apps/src/python/pjsua.py   |   16 ++++++++++------
 pjsip/src/pjsua-lib/pjsua_core.c |   21 +++++++++++++++++++++
 2 files changed, 31 insertions(+), 6 deletions(-)


- Log -----------------------------------------------------------------
commit 45a3b9fa96c72d42a83fba2fdc5043c40198c17b
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Dec 12 17:31:39 2011 -0400

    Remove the assumption that the URI scheme will always be sip. It can now be specified instead but defaults to sip to preserve previous behavior.

diff --git a/pjsip-apps/src/python/pjsua.py b/pjsip-apps/src/python/pjsua.py
index 9d68f69..9a731d2 100644
--- a/pjsip-apps/src/python/pjsua.py
+++ b/pjsip-apps/src/python/pjsua.py
@@ -742,6 +742,7 @@ class AccountConfig:
                                transport is required, 1=hop-by-hop secure
                                transport such as TLS is required, 2=end-to-
                                end secure transport is required (i.e. "sips").
+    scheme                  -- URI scheme to use when constructing URIs. Defaults to sip.
     """
     priority = 0
     id = ""
@@ -761,9 +762,10 @@ class AccountConfig:
     ka_data = "\r\n"
     use_srtp = 0
     srtp_secure_signaling = 1
+    scheme = "sip"
 
     def __init__(self, domain="", username="", password="", 
-                 display="", registrar="", proxy=""):
+                 display="", registrar="", proxy="", scheme="sip"):
         """
         Construct account config. If domain argument is specified, 
         a typical configuration will be built.
@@ -779,16 +781,17 @@ class AccountConfig:
         proxy     -- the proxy URI. If domain name is specified
                      and this argument is empty, the proxy URI
                      will be constructed from the domain name.
+        scheme    -- URI scheme to use when constructing URIs. Defaults to sip.
 
         """
         default = _pjsua.acc_config_default()
         self._cvt_from_pjsua(default)
         if domain!="":
             self.build_config(domain, username, password,
-                              display, registrar, proxy)
+                              display, registrar, proxy, scheme)
 
     def build_config(self, domain, username, password, display="",
-                     registrar="", proxy=""):
+                     registrar="", proxy="", scheme="sip"):
         """
         Construct account config. If domain argument is specified, 
         a typical configuration will be built.
@@ -804,6 +807,7 @@ class AccountConfig:
         proxy     -- the proxy URI. If domain name is specified
                      and this argument is empty, the proxy URI
                      will be constructed from the domain name.
+        scheme    -- URI scheme to use when constructing URIs. Defaults to sip.
 
         """
         if display != "":
@@ -811,12 +815,12 @@ class AccountConfig:
         userpart = username
         if userpart != "":
             userpart = userpart + "@"
-        self.id = display + "<sip:" + userpart + domain + ">"
+        self.id = display + "<" + scheme + ":" + userpart + domain + ">"
         self.reg_uri = registrar
         if self.reg_uri == "":
-            self.reg_uri = "sip:" + domain
+            self.reg_uri = scheme + ":" + domain
         if proxy == "":
-            proxy = "sip:" + domain + ";lr"
+            proxy = scheme + ":" + domain + ";lr"
         if proxy.find(";lr") == -1:
             proxy = proxy + ";lr"
         self.proxy.append(proxy)

commit d359a6146154116c841bb5d2ba8935d94abfbefd
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Dec 12 17:18:27 2011 -0400

    Add support for retrieving information about the TLS transport.

diff --git a/pjsip/src/pjsua-lib/pjsua_core.c b/pjsip/src/pjsua-lib/pjsua_core.c
index 7ddfd59..07fcbe3 100644
--- a/pjsip/src/pjsua-lib/pjsua_core.c
+++ b/pjsip/src/pjsua-lib/pjsua_core.c
@@ -2079,6 +2079,27 @@ PJ_DEF(pj_status_t) pjsua_transport_get_info( pjsua_transport_id id,
 
 	status = PJ_SUCCESS;
 
+    } else if (pjsua_var.tpdata[id].type == PJSIP_TRANSPORT_TLS) {
+
+        pjsip_tpfactory *factory = t->data.factory;
+
+        if (factory == NULL) {
+            PJSUA_UNLOCK();
+            return PJ_EINVALIDOP;
+        }
+
+        info->id = id;
+        info->type = t->type;
+        info->type_name = pj_str("TLS");
+        info->info = pj_str("TLS transport");
+        info->flag = factory->flag;
+        info->addr_len = sizeof(factory->local_addr);
+        info->local_addr = factory->local_addr;
+        info->local_name = factory->addr_name;
+        info->usage_count = 0;
+
+        status = PJ_SUCCESS;
+
     } else {
 	pj_assert(!"Unsupported transport");
 	status = PJ_EINVALIDOP;

-----------------------------------------------------------------------


-- 
asterisk-scf/integration/pjproject.git



More information about the asterisk-scf-commits mailing list