I’m updating a script that uses AMI to originate calls but I’m having issues adding a custom sipheader (nothing exciting, we just need a client code). Much of the documentation I’ve found mentioned adding a SIPADDHEADERS variable but nothing seems to work. My current AMI action looks something like this (using the method mentioned at voip-info:
I’ve been using sngrep to watch my test calls and the X-CLIENT header just isn’t present. I’ve also attempted using __SIPADDHEADERS0. The machine in question is running Asterisk 13.38.1, which I’m unfortunately unable to update at this time. (long story). Does anyone know a method that would work with this version?
Fortunately we are using chan_pjsip… so now that you mention it, using SIPADDHEADER likely wouldn’t work anyway! I’m not having much luck finding an AMI alternative to PJSIP_HEADER(which is generally what I’d use in dialplan).
This is kind of uncharted territory for me as well - I’ve never had issues assigning sipheaders from within the dialplan. To get around this, one thing I have tried is calling into a new context as laid out in this post. This causes other issues, as the AMI script’s originate action has quite a few other variable assignments attached, so I’d prefer avoiding this option if at all possible.
Regardless, you’ve given me a great place to start. Thank you so much for your reply!
Edit: Attempted using the following. No luck but hopefully I’m going in the right direction. Using PJSIP_HEADER as a variable feels odd but these are the only examples I’ve found so far.
I ended up resolving this by redirecting from a local channel to a new context within the dialplan and setting the sipheaders in there before sending out the dial explicitly after the originate.