[SIP Beyond VoIP] Address through SylkServer

Saúl Ibarra Corretgé saul at ag-projects.com
Tue Aug 28 16:36:43 CEST 2012


Hi,

On Aug 28, 2012, at 4:16 PM, Hadzhiev, Tihomir wrote:

> Hi All,
>  
> I think I have mostly solved my problems with the session establishments, at least from the SIP/MSRP direction towards the XMPP server. And basically you guys were right that the client I’m using is not sending the invites correctly. I will have to deal a bit later with that, together with the XMPP -> MSRP sessions.
>  
> However I have another problem now.
>  
> I’m trying to make the following message flow: SIP/MSRP -> SYLK -> XMPP Server -> XMPP Backend for Facebook -> Facebook. That’s almost possible to be done, but the main problem I’m having is when I want to address message towards FaceBook user.
>  
> Currently facebook users appear in XMPP world if a backend is used the following way ( and we know they do not support federation )
>  
> -739277318\40chat.facebook.com at facebook.testing.com
> 
> What I’m having as a problem of course is the address and particularly the “\” char over there. Do you have idea how the backslash should be represented correctly? As when I enter it as a escape character, Sylk Server complains about the SIP addressing:
>  
> I’m entering the address the following way:
>  
> -739277318%5C40chat.facebook.com at facebook.testing.com
> 
>  
> 
> Then Sylk complains with the following errors:
> 
>  
> 
> [xmppgateway] New incoming SIP MESSAGE from sip:alice at open-ims.test
> 
> Traceback (most recent call last):
> 
>   File "/usr/lib/python2.7/dist-packages/twisted/internet/base.py", line 766, in runUntilCurrent
> 
>     f(*a, **kw)
> 
>   File "/usr/local/lib/python2.7/dist-packages/sylk/applications/__init__.py", line 137, in handle_notification
> 
>     handler(notification)
> 
>   File "/usr/local/lib/python2.7/dist-packages/sylk/applications/__init__.py", line 196, in _NH_SIPIncomingRequestGotRequest
> 
>     app.incoming_sip_message(request, notification.data)
> 
>   File "/usr/local/lib/python2.7/dist-packages/sylk/applications/xmppgateway/__init__.py", line 172, in incoming_sip_message
> 
>     recipient = Identity(FrozenURI.parse(to_uri))
> 
>   File "/usr/local/lib/python2.7/dist-packages/sylk/applications/xmppgateway/datatypes.py", line 62, in parse
> 
>     raise ValueError('invalid SIP uri: %s' % value)
> 
> ValueError: invalid SIP uri: sip:-739277318\40chat.facebook.com at facebook.testing.com
> 
>  
> And at the end basically in the Sylk  ( started with –no-fork ) the Value Error represents the address which I want to see sent towards the XMPP server
>  

You need to percent encode the URI so that it looks like a correct SIP URI. Here is a quick example you can try:

In [13]: s = "sip:-739277318\40chat.facebook.com at facebook.testing.com"

In [14]: s1 = urllib2.quote(s, safe='@:')

In [15]: SIPURI.parse(s)
---------------------------------------------------------------------------
SIPCoreError                              Traceback (most recent call last)
<ipython-input-15-cc9392456ecc> in <module>()
----> 1 SIPURI.parse(s)

/Users/saghul/work/ag-projects/python-sipsimple/sipsimple/core/_core.so in sipsimple.core._core.SIPURI_parse (sipsimple/core/_core.c:60045)()

SIPCoreError: Not a valid SIP URI: sip:-739277318 chat.facebook.com at facebook.testing.com

In [16]: SIPURI.parse(s1)
Out[16]: SIPURI('facebook.testing.com', '-739277318 chat.facebook.com', None, None, False, {}, {})

In [17]:


Regards,

--
Saúl Ibarra Corretgé
AG Projects





More information about the SIPBeyondVoIP mailing list