Setting From custom SIP Header

Support zone
Post Reply
carlosalbffgomes
Posts: 19
Joined: Mon Dec 12, 2011 9:27 pm

Setting From custom SIP Header

Post by carlosalbffgomes » Tue Dec 09, 2014 7:11 pm

I need to one of my SIP VoIP Providers to set a custom FROM header to be able to make a dial out call. Up to now, I used a dial plan function (see bellow) to set my custom FROM SIP Header. However, now I'm receiving a not allowed message via console, stating that it is not allowed to set such header with sys.SetCustomSIPHeader function. However, without it, I can not make a dial out call through that VoIP provider (Vono). There was any modification on SIPsorcery behavior with such SIP Header setting?

The dial plan code that I need to use to make a call out through VONO is:

Code: Select all

    sys.SetCustomSIPHeader("From","<sip:caralbffgms@67.222.131.147>")
    sys.Dial(@url)
It worked pretty good up to now when it started to say, on the console log, that was not permitted to set the above SIP Header. I've tried several variations of the sys.SetFromHeader function with no success. No variation of the parameters had the same behaviour as the sys.SetCustomHeader function that I previously used.

Regards,
Last edited by carlosalbffgomes on Tue Dec 09, 2014 9:03 pm, edited 1 time in total.

Aaron
Site Admin
Posts: 4652
Joined: Thu Jul 12, 2007 12:13 am

Re: Setting From custom SIP Header

Post by Aaron » Wed Dec 10, 2014 10:22 am

Can you try using the sys.SetFromHeader as outlined here http://www.sipsorcery.com/mainsite/Help ... ans#Header and if there is an issue with it can you post the relevant lines from a dialplan trace as per http://www.sipsorcery.com/mainsite/Help/Console.

There haven't been any updates to the sipsorcery SIP software for a while so it's unusual that it would stop working.

carlosalbffgomes
Posts: 19
Joined: Mon Dec 12, 2011 9:27 pm

Re: Setting From custom SIP Header

Post by carlosalbffgomes » Wed Dec 10, 2014 11:42 am

I'm sending the dialplan trace with both SIP Header functions.

1) With sys.SetCustomSIPHeader()
SIPTransaction=> SIPTransaction=>Request received udp:67.222.131.147:5070<-udp:67.222.131.147:5060
INVITE sip:777@67.222.131.147:8060;transport=UDP SIP/2.0
Via: SIP/2.0/UDP 67.222.131.147:5060;branch=z9hG4bK09383dbd14f3a8b5ce552743bc302eccbe9c6da7;rport=5060;received=67.222.131.147
Via: SIP/2.0/UDP 67.222.131.147:8060;branch=z9hG4bKd75253b57bbb49ff843859117c2ba892;rport
Via: SIP/2.0/UDP 194.65.225.252:34907;branch=z9hG4bK-d8754z-6b2e3049d4a9a98a-1---d8754z-;rport=34907;received=194.65.225.252
To: <sip:777@67.222.131.147:8060;transport=UDP>
From: <sip:1022@67.222.131.147:8060;transport=UDP>;tag=140c8218
Call-ID: OTQ1MzQwYWE3NmJlNTY4NTBhZGYxNGM5OWM1OGIwNGI.
CSeq: 2 INVITE
Contact: <sip:1022@194.65.225.252:34907;transport=UDP>
Max-Forwards: 69
User-Agent: Zoiper r27147
Authorization: Digest username="1022",realm="sipsorcery.com",nonce="11137667981376361786",uri="sip:777@67.222.131.147:8060;transport=UDP",response="76da71f6e644868b1aaf527594bbf7fa",algorithm=MD5
Supported: replaces, norefersub, extended-refer, timer, X-cisco-serviceuri
Content-Length: 337
Content-Type: application/sdp
Proxy-ReceivedFrom: udp:194.65.225.252:34907
Proxy-ReceivedOn: udp:67.222.131.147:8060
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE
Allow-Events: presence, kpml

v=0
o=Zoiper 0 0 IN IP4 194.65.225.252
s=Zoiper
c=IN IP4 194.65.225.252
t=0 0
m=audio 44854 RTP/AVP 97 18 3 8 0 101
a=rtpmap:97 iLBC/8000
a=fmtp:97 mode=30
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:3 GSM/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=sendrecv

DialPlan=> Dialplan trace commenced at 10 Dec 2014 03:32:25:632.
DialPlan=> DBRead sucessful for datakey "Remote-Party-ID_1022".
DialPlan=> The name of the header to set is not permitted, the header was not added.
DialPlan=> Commencing Dial with: 777@VSP_2.
DialPlan=> ForkCall commencing call leg to sip:777@vono.net.br:1571.
DialPlan=> SIPClientUserAgent Call using alternate outbound proxy of udp:67.222.131.147:5060.
DialPlan=> Switching to sip:777@vono.net.br:1571 via udp:67.222.131.147:5060.
DialPlan=> SDP on UAC call had public IP not mangled, RTP socket 194.65.225.252:44854.
SIPTransaction=> Send Request reliable udp:67.222.131.147:5070->udp:67.222.131.147:5060
INVITE sip:777@vono.net.br:1571 SIP/2.0
Via: SIP/2.0/UDP 67.222.131.147:5070;branch=z9hG4bK2fc2ac4011684150afd0f610b950e057;rport
To: <sip:777@vono.net.br:1571>
From: "Carlos Alberto Gomes" <sip:caralbffgms@vono.net.br:1571>;tag=PMEKPHGNOA
Call-ID: 18eef964b2824880ac1ba2806e6288ed
CSeq: 1 INVITE
Contact: <sip:caralbffgms@67.222.131.147:5070>
Max-Forwards: 70
User-Agent: http://www.sipsorcery.com
Content-Length: 337
Content-Type: application/sdp
Proxy-SendFrom: udp:67.222.131.147:5060

v=0
o=Zoiper 0 0 IN IP4 194.65.225.252
s=Zoiper
c=IN IP4 194.65.225.252
t=0 0
m=audio 44854 RTP/AVP 97 18 3 8 0 101
a=rtpmap:97 iLBC/8000
a=fmtp:97 mode=30
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:3 GSM/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=sendrecv

SIPTransaction=> Send Request retransmit 2 udp:67.222.131.147:5070->udp:67.222.131.147:5060
INVITE sip:777@vono.net.br:1571 SIP/2.0
Via: SIP/2.0/UDP 67.222.131.147:5070;branch=z9hG4bK2fc2ac4011684150afd0f610b950e057;rport
To: <sip:777@vono.net.br:1571>
From: "Carlos Alberto Gomes" <sip:caralbffgms@vono.net.br:1571>;tag=PMEKPHGNOA
Call-ID: 18eef964b2824880ac1ba2806e6288ed
CSeq: 1 INVITE
Contact: <sip:caralbffgms@67.222.131.147:5070>
Max-Forwards: 70
User-Agent: http://www.sipsorcery.com
Content-Length: 337
Content-Type: application/sdp
Proxy-SendFrom: udp:67.222.131.147:5060

v=0
o=Zoiper 0 0 IN IP4 194.65.225.252
s=Zoiper
c=IN IP4 194.65.225.252
t=0 0
m=audio 44854 RTP/AVP 97 18 3 8 0 101
a=rtpmap:97 iLBC/8000
a=fmtp:97 mode=30
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:3 GSM/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=sendrecv

SIPTransaction=> Received Response udp:67.222.131.147:5070<-udp:67.222.131.147:5060
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 67.222.131.147:5070;branch=z9hG4bK2fc2ac4011684150afd0f610b950e057;rport
To: <sip:777@vono.net.br:1571>
From: "Carlos Alberto Gomes" <sip:caralbffgms@vono.net.br:1571>;tag=PMEKPHGNOA
Call-ID: 18eef964b2824880ac1ba2806e6288ed
CSeq: 1 INVITE
Content-Length: 0
Proxy-ReceivedFrom: udp:201.86.87.36:1571
Proxy-ReceivedOn: udp:67.222.131.147:5060


DialPlan=> Information response 100 Trying for sip:777@vono.net.br:1571.
SIPTransaction=> Received Response udp:67.222.131.147:5070<-udp:67.222.131.147:5060
SIP/2.0 403 Forbidden
Via: SIP/2.0/UDP 67.222.131.147:5070;branch=z9hG4bK2fc2ac4011684150afd0f610b950e057;rport
To: <sip:777@vono.net.br:1571>;tag=aprqngfrt-2iv4b03000020
From: "Carlos Alberto Gomes" <sip:caralbffgms@vono.net.br:1571>;tag=PMEKPHGNOA
Call-ID: 18eef964b2824880ac1ba2806e6288ed
CSeq: 1 INVITE
Content-Length: 0
Proxy-ReceivedFrom: udp:201.86.87.36:1571
Proxy-ReceivedOn: udp:67.222.131.147:5060


SIPTransaction=> Send Request udp:67.222.131.147:5070->udp:67.222.131.147:5060
ACK sip:777@vono.net.br:1571 SIP/2.0
Via: SIP/2.0/UDP 67.222.131.147:5070;branch=z9hG4bK2fc2ac4011684150afd0f610b950e057;rport
To: <sip:777@vono.net.br:1571>;tag=aprqngfrt-2iv4b03000020
From: "Carlos Alberto Gomes" <sip:caralbffgms@vono.net.br:1571>;tag=PMEKPHGNOA
Call-ID: 18eef964b2824880ac1ba2806e6288ed
CSeq: 1 ACK
Max-Forwards: 70
Content-Length: 0
Proxy-SendFrom: udp:67.222.131.147:5060


DialPlan=> Response 403 Forbidden for sip:777@vono.net.br:1571.
DialPlan=> Dialplan cleanup for carlosalbffgomes.
DialPlan=> Closing user database connection for carlosalbffgomes.
SIPTransaction=> Send Final Response Reliable udp:67.222.131.147:5070->67.222.131.147:5060
SIP/2.0 403 Forbidden
Via: SIP/2.0/UDP 67.222.131.147:5060;branch=z9hG4bK09383dbd14f3a8b5ce552743bc302eccbe9c6da7;rport=5060;received=67.222.131.147
Via: SIP/2.0/UDP 67.222.131.147:8060;branch=z9hG4bKd75253b57bbb49ff843859117c2ba892;rport
Via: SIP/2.0/UDP 194.65.225.252:34907;branch=z9hG4bK-d8754z-6b2e3049d4a9a98a-1---d8754z-;rport=34907;received=194.65.225.252
To: <sip:777@67.222.131.147:8060;transport=UDP>
From: <sip:1022@67.222.131.147:8060;transport=UDP>;tag=140c8218
Call-ID: OTQ1MzQwYWE3NmJlNTY4NTBhZGYxNGM5OWM1OGIwNGI.
CSeq: 2 INVITE
Allow: ACK, BYE, CANCEL, INFO, INVITE, NOTIFY, OPTIONS, REFER, REGISTER, SUBSCRIBE
Content-Length: 0


DialPlan=> Dialplan trace completed at 10 Dec 2014 03:32:58:789.
2) With sys.SetFromHeader():
SIPTransaction=> SIPTransaction=>Request received udp:67.222.131.147:5070<-udp:67.222.131.147:5060
INVITE sip:777@67.222.131.147:8060;transport=UDP SIP/2.0
Via: SIP/2.0/UDP 67.222.131.147:5060;branch=z9hG4bKd5328a12048134bca2142de5dd542e6982aef879;rport=5060;received=67.222.131.147
Via: SIP/2.0/UDP 67.222.131.147:8060;branch=z9hG4bK81afe4d60b4344229bcb7ff43097d7c5;rport
Via: SIP/2.0/UDP 194.65.225.252:34907;branch=z9hG4bK-d8754z-b32804a67038ebc4-1---d8754z-;rport=34907;received=194.65.225.252
To: <sip:777@67.222.131.147:8060;transport=UDP>
From: <sip:1022@67.222.131.147:8060;transport=UDP>;tag=6f325e66
Call-ID: MmRkNWI4YWE5YzBjMjRlYTNlZDRmYTA0OTEwOWRjMzQ.
CSeq: 2 INVITE
Contact: <sip:1022@194.65.225.252:34907;transport=UDP>
Max-Forwards: 69
User-Agent: Zoiper r27147
Authorization: Digest username="1022",realm="sipsorcery.com",nonce="10195951891942079900",uri="sip:777@67.222.131.147:8060;transport=UDP",response="fa5fac6748bad9e0474815b826cad1aa",algorithm=MD5
Supported: replaces, norefersub, extended-refer, timer, X-cisco-serviceuri
Content-Length: 337
Content-Type: application/sdp
Proxy-ReceivedFrom: udp:194.65.225.252:34907
Proxy-ReceivedOn: udp:67.222.131.147:8060
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE
Allow-Events: presence, kpml

v=0
o=Zoiper 0 0 IN IP4 194.65.225.252
s=Zoiper
c=IN IP4 194.65.225.252
t=0 0
m=audio 44854 RTP/AVP 97 18 3 8 0 101
a=rtpmap:97 iLBC/8000
a=fmtp:97 mode=30
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:3 GSM/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=sendrecv

DialPlan=> Dialplan trace commenced at 10 Dec 2014 03:36:06:432.
DialPlan=> DBRead sucessful for datakey "Remote-Party-ID_1022".
DialPlan=> Commencing Dial with: 777@VSP_2.
DialPlan=> ForkCall commencing call leg to sip:777@vono.net.br:1571.
DialPlan=> SIPClientUserAgent Call using alternate outbound proxy of udp:67.222.131.147:5060.
DialPlan=> Switching to sip:777@vono.net.br:1571 via udp:67.222.131.147:5060.
DialPlan=> SDP on UAC call had public IP not mangled, RTP socket 194.65.225.252:44854.
SIPTransaction=> Send Request reliable udp:67.222.131.147:5070->udp:67.222.131.147:5060
INVITE sip:777@vono.net.br:1571 SIP/2.0
Via: SIP/2.0/UDP 67.222.131.147:5070;branch=z9hG4bKb3c31cedf5954b1fb084042226610986;rport
To: <sip:777@vono.net.br:1571>
From: "caralbffgms" <sip:caralbffgms@67.222.131.147>;tag=FDFCJPQTMA
Call-ID: b13e9b811dfb4c7eaaf3ef9efe018c58
Via: SIP/2.0/UDP 67.222.131.147:5070;branch=z9hG4bKb3c31cedf5954b1fb084042226610986;rport
To: <sip:777@vono.net.br:1571>
From: "caralbffgms" <sip:caralbffgms@67.222.131.147>;tag=FDFCJPQTMA
Call-ID: b13e9b811dfb4c7eaaf3ef9efe018c58
CSeq: 1 INVITE
Content-Length: 0
Proxy-ReceivedFrom: udp:201.86.87.36:1571
Proxy-ReceivedOn: udp:67.222.131.147:5060


DialPlan=> Information response 100 Trying for sip:777@vono.net.br:1571.
SIPTransaction=> Received Response udp:67.222.131.147:5070<-udp:67.222.131.147:5060
SIP/2.0 403 Forbidden
Via: SIP/2.0/UDP 67.222.131.147:5070;branch=z9hG4bKb3c31cedf5954b1fb084042226610986;rport
To: <sip:777@vono.net.br:1571>;tag=aprqngfrt-8kuo733000020
From: "caralbffgms" <sip:caralbffgms@67.222.131.147>;tag=FDFCJPQTMA
Call-ID: b13e9b811dfb4c7eaaf3ef9efe018c58
CSeq: 1 INVITE
Content-Length: 0
Proxy-ReceivedFrom: udp:201.86.87.36:1571
Proxy-ReceivedOn: udp:67.222.131.147:5060


SIPTransaction=> Send Request udp:67.222.131.147:5070->udp:67.222.131.147:5060
ACK sip:777@vono.net.br:1571 SIP/2.0
Via: SIP/2.0/UDP 67.222.131.147:5070;branch=z9hG4bKb3c31cedf5954b1fb084042226610986;rport
To: <sip:777@vono.net.br:1571>;tag=aprqngfrt-8kuo733000020
From: "caralbffgms" <sip:caralbffgms@67.222.131.147>;tag=FDFCJPQTMA
Call-ID: b13e9b811dfb4c7eaaf3ef9efe018c58
CSeq: 1 ACK
Max-Forwards: 70
Content-Length: 0
Proxy-SendFrom: udp:67.222.131.147:5060


DialPlan=> Response 403 Forbidden for sip:777@vono.net.br:1571.
DialPlan=> Dialplan cleanup for carlosalbffgomes.
DialPlan=> Closing user database connection for carlosalbffgomes.
SIPTransaction=> Send Final Response Reliable udp:67.222.131.147:5070->67.222.131.147:5060
SIP/2.0 403 Forbidden
Via: SIP/2.0/UDP 67.222.131.147:5060;branch=z9hG4bKd5328a12048134bca2142de5dd542e6982aef879;rport=5060;received=67.222.131.147
Via: SIP/2.0/UDP 67.222.131.147:8060;branch=z9hG4bK81afe4d60b4344229bcb7ff43097d7c5;rport
Via: SIP/2.0/UDP 194.65.225.252:34907;branch=z9hG4bK-d8754z-b32804a67038ebc4-1---d8754z-;rport=34907;received=194.65.225.252
To: <sip:777@67.222.131.147:8060;transport=UDP>
From: <sip:1022@67.222.131.147:8060;transport=UDP>;tag=6f325e66
Call-ID: MmRkNWI4YWE5YzBjMjRlYTNlZDRmYTA0OTEwOWRjMzQ.
CSeq: 2 INVITE
Allow: ACK, BYE, CANCEL, INFO, INVITE, NOTIFY, OPTIONS, REFER, REGISTER, SUBSCRIBE
Content-Length: 0


DialPlan=> Dialplan trace completed at 10 Dec 2014 03:36:38:964.

carlosalbffgomes
Posts: 19
Joined: Mon Dec 12, 2011 9:27 pm

Re: Setting From custom SIP Header

Post by carlosalbffgomes » Wed Dec 10, 2014 11:49 am

The only difference that I see, from SIPsorcery point of view, is that before, when I used the sys.SetCustomSIPHeader(), I dindn't get the "The name of the header to set is not permitted, the header was not added" message that now I'm getting. It never worked with the sys.SetFromHeader() function. So I'm puzzled.

carlosalbffgomes
Posts: 19
Joined: Mon Dec 12, 2011 9:27 pm

Re: Setting From custom SIP Header

Post by carlosalbffgomes » Wed Dec 10, 2014 2:21 pm

I've been digging the VONO literature, despite it is too old and may be inaccurate.
They write that their SIP server compares:
a) "TO" from register SIP message with "FROM" from the invite SIP message. They should be equal.
b) "CONTACT" from register SIP message and from invite SIP message should also be equal.
If those conditions are not met then the VONO SIP server doesn't allow the call.
This information may be inaccurate, I should say, as it is from 2006 and I've been able to use VONO with Voxalot and MySIPSwitch without any special configuration. And most probably they have changed their configuration several times in order to try to sell their services (they have an PBAX service which is too expensive for non Brazilian standards). So some of these problems may be caused by their change of configurations without any public notice. However, as I've stated above, it worked when the 'sys.SetCustomSIPHeader()' fuction was allowed to set the "FROM" parameter.

Aaron
Site Admin
Posts: 4652
Joined: Thu Jul 12, 2007 12:13 am

Re: Setting From custom SIP Header

Post by Aaron » Thu Dec 11, 2014 9:16 am

From those traces the first problem you've got is that by customising the From header on the INVITE request to your provider you have broken the authentication. The 403 Forbidden response means that the username on the request wasn't recognised. The username is part of the From header which is why you it can be tricky to customise it.

As a test stop using the SetCustomHeader and SetFromHeader functions and instead try just changing the From header display name using a dial string option.

Code: Select all

sys.Dial("1234@provider[fd=987654321]")
You can also use the fu and fh options to customise the other parts of the From header but that's where you will start to run into problems with the provider authenticating the call and you'll need to either talk to them or use trial and error.

Code: Select all

sys.Dial("1234@provider[fd=987654321,fu=777,fh=67.222.1131.147]")
Note the dial string options have exactly the same effect as the sys.SetFromHeader method so if you really want you can use it instead and leave some of the fields as nil.

carlosalbffgomes
Posts: 19
Joined: Mon Dec 12, 2011 9:27 pm

Re: Setting From custom SIP Header

Post by carlosalbffgomes » Thu Dec 11, 2014 8:35 pm

No luck. It still gives me the 403 Forbidden error. As I have stated before, it never worked with the "sys.SetFromHeader()", despite any possible combination of parameters I used (or with 'sys.Dial("123@VSP[fd=1234]" etc.). It only worked when it was possible to set an arbitrary Custom SIP Header -- such as 'FROM" -- with 'sys.SetCustomSIPHeader()' function. Maybe it had two distinct 'FROM' SIP headers, but for some reason it worked.

Aaron
Site Admin
Posts: 4652
Joined: Thu Jul 12, 2007 12:13 am

Re: Setting From custom SIP Header

Post by Aaron » Sun Dec 14, 2014 9:01 am

I'm not too sure what the fix could be sorry.

I am pretty sure that the sys.SetCustomSIPHeader has not been allowed to set the From header for quite a while. The From header needs to have a special field called a tag appended to it and if that is fiddled with the SIP agents at either end won't be able to match the SIP messages to the correct transaction.

carlosalbffgomes
Posts: 19
Joined: Mon Dec 12, 2011 9:27 pm

Re: Setting From custom SIP Header

Post by carlosalbffgomes » Mon Dec 15, 2014 11:59 am

Anyway, thank you for your help. I think the problem is with VONO that changes their configuration without prior notice. And there is no real technical support desk, despite that some of these modifications may be intentional to make their service not worth with any other PABXs (they sell a PABX service but higher priced when compared with any international alternative). Technically, I think the problem is in the SIP dialogues, because the SIP registration contact and the SIP invite contact have not the same IP address. And for that reason, it responds with a 403 Forbidden. But anyway, I really only use VONO to dial in calls and that is working OK with SIPSorcery.

Post Reply