Author Topic: Changing SIP headers on nib.js  (Read 3909 times)

ce-uk

  • Newbie
  • *
  • Posts: 10
    • View Profile
Changing SIP headers on nib.js
« on: January 18, 2015, 05:11:33 AM »
How can someone change SIP headers such as From:User part, Contact: User part, or Remote party ID on outbound calls?

Currently I have a mock VoIP provider set up but on outbound calls, Yate is sending the extension number of the phone instead of sending the line number associated with the SIP trunk.

I keep getting spoofed URI responses from the VoIP provider as a result.  :-\

Monica Tepelus

  • Administrator
  • Full Member
  • *****
  • Posts: 196
    • View Profile
Re: Changing SIP headers on nib.js
« Reply #1 on: January 20, 2015, 05:23:43 AM »
hi,

You will need to modify the code a little in function routeOutside. You can change the caller directly from there.
Other headers can be set with:

msg["osip_"+headername] = headervalue;



ce-uk

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Changing SIP headers on nib.js
« Reply #2 on: February 03, 2015, 05:21:55 AM »
Thanks, that works a treat  :D

for your example, would it be possible to use a variable from the [outbound] line in accfile.conf as a header (e.g. 'authname') or does the header need to be explicitly stated in the routeOutside function?

Monica Tepelus

  • Administrator
  • Full Member
  • *****
  • Posts: 196
    • View Profile
Re: Changing SIP headers on nib.js
« Reply #3 on: February 03, 2015, 08:47:56 AM »
Hi,

You can't set this in accfile.conf Accfile contains the autentification information.

Adding a custom header to a call must be done in the routing stage: either in routeOutside() in nib.js or from another routing module that catches call.route/call.execute and adds that custom header.

ce-uk

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Changing SIP headers on nib.js
« Reply #4 on: February 03, 2015, 10:34:33 AM »
How do calls currently route from the phone to the outbound line normally?

Is it nib.js --> accfile.conf --> out

or are there additional routing routing stages where I can set these values? I'm looking to have different lines used by different msisdns. With these lines, things like 'From' and 'Contact' would need to be fixed value specific to the line.

Monica Tepelus

  • Administrator
  • Full Member
  • *****
  • Posts: 196
    • View Profile
Re: Changing SIP headers on nib.js
« Reply #5 on: February 05, 2015, 02:55:58 AM »
Hi,

You can have as many hooks as you want from other routing modules by installing more handlers for call.route message.
Some people do some more processing in call.preroute stage or you can install more call.route handlers.
You could also set those parameters in call.execute but not handle it.

Start yatebts with "sniffer on" from telnet and follow this messages. Depending on when you need this parameters (before/after functions done in nib.js) will tell you what works best for you.