Page 1 of 1

add custom sip header before sending call to carrier

PostPosted: Sat Oct 29, 2011 2:27 pm
by zeeshansajid
Hi Guys,

I need to send a couple of custom sip headers to my carrier for billing different customers on a single vicidial install. I know in asterisk we can add sip headers, but my question is if i can do it in an agi script if yes which one and how. I am sure somebody else must have implemented it but i could not find any post when i searched it on the forum. Any help is greatly appreciated. Thanks in advance.

Vici Rox
best regards,
Zeeshan Sajid

PostPosted: Sat Oct 29, 2011 2:47 pm
by williamconley
adding sip headers is fairly easy. can be done in the "carrier" field under "dial plan". create a different carrier for each set of headers.

but how will you differentiate between when to send which header? is each client on a different campaign?

If so, you will just use a different dial prefix for each campaign, leading to a different "carrier" in vicidial, even though they all actually go to the SAME carrier when the leave "the box".

They can even all share a single "account entry" but with different "dial plan" settings, leaving the account entry blank on all but one carrier.

RE add custom sip header before sending call to carrier

PostPosted: Sun Oct 30, 2011 1:26 pm
by zeeshansajid
Hi William,

Are you referring to the carrier settings section under admin settings, if yes i do see a dial plan entry and there we use the carrier's name to send the call out, but i am not sure if i have the campaign ID available there, so a better explanation would be greatly appreciated. Thanks

Zeeshan Sajid

PostPosted: Sun Oct 30, 2011 11:06 pm
by zeeshansajid
Hi,

Here is what i have in mind, for all kinds of campaigns, the agi-VDAD_ALL_outbound.agi is invoked, so there i also have the campaign ID, so i should try and set the custom header for campaign ID, in here, and then when i sent it to my termination gateway i can read the campaign ID and bill the customer for the campaign usage.


Please correct me if i am wrong. Also please enclose the command for setting customer sip header using the SIPAddHeader command in an agi script. Thanks

best regards,
Zeeshan Sajid

PostPosted: Mon Oct 31, 2011 10:51 am
by williamconley
since you already have the command, you should try using it in the dial plan in carriers instead of modifying your agi script. remember that when you upgrade vicidial ... that script may have changes requiring you to "repatch". Not to mention the possibility that you could mess up the programming of the agi while messing around in there.

but adding it to your dialplan instead could require a sep carrier for each campaign, but would be upgrade safe (and NOT require modification of any "code" on the server at all).

Merely adding an extra line to the dial plan which adds a sip header using standard asterisk dial plan language. No programming modifications. 8-)

PostPosted: Tue Nov 01, 2011 5:42 pm
by zeeshansajid
Hi William,

My scenario is that i am running a broadcast survey campaign, now my understanding is that the ast_managersend.pl script is creating the originate command as initiating the call, now i agree i should just be able to add a line to add a sip header in my carrier settings page.

Action: Originate
Exten: 8375
Context: default
Channel: Local/9XXXXXXXX10@default
Priority: 1
Callerid: "V4335465017611366" <MY NUMBER>
Timeout: 90000
VDACnote: TESTCAMPAIGN|17234366|1|404XXXX10|OUT|NONE|99

so i was wondering what VDACnote means, i know if i had

Variable: var1=23|var2=24|var3=25

in the above originate command, i would have just written the test campaign value into a channel variable and would just get it, so my question now is

Is there a way to get the TESTCAMPAIGN saved from VDACnote??

Please HELP
Thanks
best regards,
Zeeshan Sajid.

PostPosted: Tue Nov 01, 2011 6:03 pm
by mflorell
Take a look at the agi-set_variables.agi script, it will let you set channel variables without messing with anything except for dialplan coding. We have used this in the past to do sip-header setting based upon lead/campaign data.

PostPosted: Tue Nov 01, 2011 6:54 pm
by zeeshansajid
thankx matt ... it worked like a charm :)

cheers

Re:

PostPosted: Tue Jun 30, 2020 1:48 pm
by Op3r
mflorell wrote:Take a look at the agi-set_variables.agi script, it will let you set channel variables without messing with anything except for dialplan coding. We have used this in the past to do sip-header setting based upon lead/campaign data.


Matt,

Can you post an example on how to send data from lead data using agi-set_variables?

Do i need to add SIPheader on my dialplan or the agi will do it for me?

Re: add custom sip header before sending call to carrier

PostPosted: Tue Jun 30, 2020 5:57 pm
by mflorell
All the set variables AGI script does is set the variables, it does not touch SIP headers, so you'd have to do that in the dialplan after the AGI runs.

Re: add custom sip header before sending call to carrier

PostPosted: Tue Jul 07, 2020 3:46 pm
by Op3r
Hi Matt,

will this work?

exten => _91NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
same => n,AGI(agi-set_variables.agi,)
same => n,SipAddHeader($first_name)
same => n,SipAddHeader($last_name)
same => n,SipAddHeader($address1)
same => n,SipAddHeader($city)
same => n,Dial(${TESTSIPTRUNK}/${EXTEN:2},,tTor) exten => _91NXXNXXXXXX,n,Hangup

Re: add custom sip header before sending call to carrier

PostPosted: Thu Jul 09, 2020 12:56 pm
by Op3r
yep it worked.

Re: add custom sip header before sending call to carrier

PostPosted: Fri Jul 10, 2020 8:13 pm
by carpenox
good shit...