[Twisted-Python] SIP protocol Via header doesn't compatible with SIP RFC3261.

RuiQiang Huang hrqiang at gmail.com
Fri Jul 6 15:49:44 EDT 2012

Via header is different between RFC2543 and RFC3261.
Based on RFC3261, Via header BNF is

    Via               =  ( "Via" / "v" ) HCOLON via-parm *(COMMA via-parm)
via-parm          =  sent-protocol LWS sent-by *( SEMI via-params )
via-params        =  via-ttl / via-maddr
                     / via-received / via-branch
                     / via-extension
via-ttl           =  "ttl" EQUAL ttl
via-maddr         =  "maddr" EQUAL host
via-received      =  "received" EQUAL (IPv4address / IPv6address)
via-branch        =  "branch" EQUAL token
via-extension     =  generic-param

That means parseViaHeader should return a tuple, instead of single via object.
Top via will be parse first via header and first element in the tuple.
This fix is required because if message coming from Via, and it inject
Via header like this
Via: SIP/2.0/UDP;branch=z9hG4bK5af66076b7a656376f671478bb7a4b3f,SIP/2.0/UDP;branch=z9hG4bKfbbb8cf0FF120663;received=;rport=13582
current SIP stack cannot send the response to
Instead, it sends to that never get to the other side.
So I fixed this to have my SIP program working with proxy.
I have a patch for this. Please let me know how to submit to SVN.


More information about the Twisted-Python mailing list