Showing posts with label pjsua. Show all posts
Showing posts with label pjsua. Show all posts

Sunday, 1 September 2013

Python - Sip2sip Outgoing call with Pjsua

Error code
sip:ID@sip2sip.info
Failed to send Request msg INVITE/cseq=19833 err=171060 (Unsupported transport (PJSIP_EUNSUPTRANSPORT))
Call with sip:ID@sip2sip.info is DISCONNCTD last code = 503 (Unsupported t
ransport (PJSIP_EUNSUPTRANSPORT)) 
Add TLS support
sip:ID@sip2sip.info;transport=tls

Reference:

Friday, 30 August 2013

Python - Sip2sip with Pjsua

Rebuild Python Pjsua TLS Support with VS2008

config_site.h
#include <pj/config_site_sample.h>
#define PJ_HAS_SSL_SOCK 1
VC++ Header and Library Path

Build then Install
pjproject\pjsip-apps\lib\_pjsua.pyd
python pjsip-apps\src\python\setup-vc.py install

Sip2Sip.info Authentication Script
try:
    ua_cfg = pj.UAConfig()
    ua_cfg.nameserver = ['8.8.8.8', '8.8.4.4'] # Example: Google Public DNS
    lib.init(ua_cfg=ua_cfg, log_cfg=pj.LogConfig(level=4, callback=log_cb))
    transport = lib.create_transport(pj.TransportType.TLS, pj.TransportConfig(port=5060))
    lib.start()
 
    acc_cfg = pj.AccountConfig()
    acc_cfg.id = "sip:ID@sip2sip.info"
    acc_cfg.reg_uri = "sip:sip2sip.info;transport=tls"
    acc_cfg.auth_cred = [pj.AuthCred(
        realm="sip2sip.info",
        username="USERNAME",
        passwd="PASSWORD",
    )]
    acc_cb = MyAccountCallback(acc_cfg)
    acc = lib.create_account(acc_cfg, cb=acc_cb)
except Exception, err:
    print 'Error creating account:', err
References:
http://trac.pjsip.org/repos/wiki/Getting-Started/Installing-OpenSSL-Windows
http://trac.pjsip.org/repos/wiki/TLS

Thursday, 29 August 2013

Python - Pjsua 1.16 Build Fixes for Windows

Build Python2.7 x32 Windows 7 x64
pjsua==1.16-svn
http://svn.pjsip.org/repos/pjproject/branches/1.x/
Python2.7 <- Visual Studio 2008

VC++ Include & Library Directory (MenuBar -> Tools -> Options)



Replace python24.lib to python27.lib
py_pjsua.dsp
py_pjsua.vcproj
python_pjsua.vcproj
python_pjsua.dsp
Save as UTF-8 or Unicode (Optional)
g7221.h
Backup compiled pjsua 1.16:
pjproject\pjsip-apps\lib\_pjsua.pyd
python pjsip-apps\src\python\setup-vc.py install
https://www.dropbox.com/s/sgdrp8yxk2v6xe6/_pjsua.pyd

References: 
http://trac.pjsip.org/repos/wiki/Getting-Started/Download-Source
http://trac.pjsip.org/repos/wiki/Python_SIP/Build_Install
http://trac.pjsip.org/repos/wiki/Getting-Started/Windows