Author Topic: Custom sip header sent from client?  (Read 9618 times)

nkehagias

  • Newbie
  • *
  • Posts: 3
    • View Profile
Custom sip header sent from client?
« on: May 17, 2017, 07:57:56 AM »
Hi,  I need to send some custom sip header variables when I call into an ivr system with the yate client.  How can I set this up?  I tried fooling with some of the config files based on what I found in the yate wiki but it didnt work. I think it may have been how to set it up for a server?  Im not sure as I am new to all this stuff.

Basically I need to send multiple headers.  1 would be something like this:
x-scn-data: 1234|5678|abcd

Any help would be greatly appreciated.
Thanks

marian

  • Hero Member
  • *****
  • Posts: 513
    • View Profile
Re: Custom sip header sent from client?
« Reply #1 on: May 18, 2017, 02:35:00 AM »
The prefix to be used is osip_
E.g. to send a x-scn-data header you must add to call.execute message:
osip_x-scn-data=header_value

You must handle the call.execute message and add this parameter

CLIENT_ACCOUNT_NAME: Account name shown in YateClient
You may want to match it.

regexroute example:

[extra]
call.execute=

[call.execute]
; Add for specified account only
${line}CLIENT_ACCOUNT_NAME=;osip_x-scn-data=1234|5678|abcd
; Add for all calls
.*=;osip_x-scn-data=1234|5678|abcd

nkehagias

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Custom sip header sent from client?
« Reply #2 on: May 18, 2017, 09:57:42 AM »
Hi marian, thanks for the reply. 

Maybe there is something simple I am not understanding but it doesn't seem to work for me. \

This is actually on a mac installed from a dmg.
So, in /Applications/YateClient.app/Contents/MacOS/conf.d/regexroute.conf

Under [extra] heading I placed
call.execute=120

I also tried empty value as in your post and other lower and higher values.


Then I created the heading [call.execute]  immediately under the [extra] block and added the line:
.*=;osip_x-scn-data=1234|5678|abcd

Then restart yate to make sure it has new info.   
That should be all that is needed to make this work?

I also added ^.*$=echo in call execute
to the [call.execute] block but I did not see it appear in the debug window.  So im not even sure if yate is reading the config file.  Is there some way to test that?

Thank you again for any help

marian

  • Hero Member
  • *****
  • Posts: 513
    • View Profile
Re: Custom sip header sent from client?
« Reply #3 on: May 19, 2017, 12:31:28 AM »
My mistake.
Please set
[extra]
call.execute=10

This way you will catch call.execute before destination module.
When handled by a module (call succeeded) your handler won't be called.
Lower value (10) means higher priority!

nkehagias

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Custom sip header sent from client?
« Reply #4 on: May 19, 2017, 08:19:30 AM »
Awesome, that works.  Thanks!

One other question maybe you can answer?

Is it possible to change a variable value everytime a call is placed?  For example I set a variable in the [$init] part of the regexroute.conf script like this:
[$init]
letters=abcd

then used it in the header like this:
x-scn-data=1234|5678|$(letters)

which works great, but if I change the variable $(letters) I must quit yate and restart it for the change to take effect.

I guess it only reads the config files at start. 
Is there some mechanism to change the vars for every call?