Search code examples
sipasterisk

Add SIP header when originating via Asterisk callfile


I need a way to add SIP headers when originating a call using an Asterisk callfile.

Is there any way to add SIP header in the call file?

I know I can accomplish this using Asterisk AGI, but I am not able to find any solution to add a SIP header using a call file.


Solution

  • What you're looking for is Set: __SIPADDHEADER1=X-foo:bar

    Make sure you increment the number, "N" at the end of __SIPADDHEADERN to 1, 2, ... 100 etc. You'll have trouble adding multiples otherwise

    Here's a (granted, modified) example from a callfile I use to issue test calls to my platform:

    Channel: SIP/foodevice/8025551212
    Callerid: 8025551111 <some dude>
    MaxRetries: 0
    RetryTime: 60
    WaitTime: 30
    Context: testplan_origination
    Set: __SIPADDHEADER1=X-testplan:testing1234
    

    Note that the Context: line would allow you to also do this by entering into a dialplan context, and you can do what you may with the call from there, using @arheops suggestion.