Asterisk 18,1 PJSIP Alert-Info header passthrough?

Hi,
I am trying to get Polycom VVX501 phones to be able to send an “Intercom Call” between each other.
Which will make other phone answer automatically in handsfree speaker on “Intercom mode”.
When one of the Intercom phone places a call (in Intercom mode) it sets the SIP header Alert-Info field to “Intercom”.

Asterisk rewrites the INVITE and does not pass this field through to the other phone on the INVITE.
Is there an easy (or way) to simply pass this through so the phone on the far end gets this field?
I think this is all I need to make it work.
When the phone places a “normal” call to the same destination the calling phone does not
create this Alert-Info field in the header. which is what is wanted in a normal call.

I’m for whatever reason having a really hard time finding answers to this.

Thanks!

This works- Asterisk/PJSim to manually generate an Alert-Info header
But I really would like to be able to duplicate what is being send from the phone
and pass or repeat it though.
And not insert it if the original call does not contain the Alert-Info header.

exten => 277,1,Dial(PJSIP/277,b(normal-ringer^addheader^1))

[normal-ringer]
exten => addheader,1,Set(PJSIP_HEADER(add,Alert-Info)=)

I’m guessing there’s a way to read it into a variable inbound and then write it back out outbound?

The PJSIP_HEADER dialplan function can also be used to read in headers from an incoming INVITE, and the ‘b’ option to Dial also allows arguments, so you could pass the value in as an argument.

So are you saying there is a way that I can get the header field from the inbound leg store it into a variable
and then subsequently read that same variable and write the retrieved/stored value out into a new Alert-Info header in the outbound leg?
I’m really not familiar with PJSIP and addheader and PJSIP_HEADER.
Do you know where I can find any examples of doing exactly this? or something really similar?
Thanks!

I don’t know of any examples of doing this exactly, what yes you can do that I believe. To get a header on an incoming INVITE you would do:

${PJSIP_HEADER(read,Alert-Info)}

Thanks!
But where did it go? Where is the value that was read in this command stored?
How do I reference it now?

Also the documentation only refers to " * read - Returns instance number of header name ."
AM I totally missing something?

https://wiki.asterisk.org/wiki/display/AST/Asterisk+18+Function_PJSIP_HEADER

That’s dependent on your dialplan. For example (untested):

exten => 277,1,Dial(PJSIP/277,b(normal-ringer^addheader^1(${PJSIP_HEADER(read,Alert-Info)})))

[normal-ringer]
exten => addheader,1,Set(PJSIP_HEADER(add,Alert-Info)=${ARG1})

The ‘b’ option allows passing in arguments that can then be read in the subroutine. PJSIP_HEADER is used to read in the value from the calling channel and pass it as an argument into the subroutine, where it is then used to add an Alert-Info header to the called channel.

1 Like

Thanks I will need to try this!
Thanks for being patient with my unfamiliarity and questions here.

What is “${ARG1}” ?
And where did it come from? What does it mean?
There is no mention of this in the Docs and information included with PJSIP_HEADER linked above.
Thanks!

It’s documented on the Gosub dialplan application[1] wiki page which includes examples. It means the first argument passed to the subroutine.

[1] https://wiki.asterisk.org/wiki/display/AST/Gosub

1 Like

Thanks!!!
Going to try some things here!
Will report back with success hopefully soon :slight_smile:

I’m having extreme difficulty as I seriously do not understand all of the different symbols and brackets.
To the point of I really don’t know where to begin.
Why is there a double comma on the dial? why not just one?
What does ^ mean? What is = ?
what is $ ?

Sorry I am not a programmer.
I don’t know if this is some freaky programming language or twisted regex stanrard regex C++ regex Unix regex or what?
Where can I go learn this step by step so that I can use it?

exten => 1,1,Set(=${PJSIP_HEADER(remove,X-MyHeader)})
Dial(PJSIP/209,b(steve-ringer^addheader^1))

I’ll figure it out.
Just have to learn a few basics?
I’m guessing it’s similar to bash?
Please let me know if it’s not.

Dialplan language is its own thing, with examples and such being present on asteriskdocs.org from the Asterisk book[1]. There is also a section on deeper things such as dialplan functions[2]. The meaning of ^ and such is also documented on the wiki and is configuration for subroutines[3] when used in the Dial application as a method of passing in its different parts.

[1] http://asteriskdocs.org/en/3rd_Edition/asterisk-book-html-chunk/asterisk-DP-Basics.html
[2] http://asteriskdocs.org/en/3rd_Edition/asterisk-book-html-chunk/asterisk-DP-Deeper.html
[3] https://wiki.asterisk.org/wiki/display/AST/Asterisk+18+Application_Dial

1 Like

Dialplans are computer programs. You need to understand programming concepts to configure Asterisk, as Asterisk is a toolkit for constructing PABXes, not a PABX that just needs a few configuration details added.

FreePBX, for example is a PABX built from Asterisk, although even then, many people want to go beyond what it can do itself, and therefore have to add custom programming (which may actually be more difficult, as you have to work within the constraints of the original programming).

Asterisk doesn’t have a feature to pass through SIP header information, but rather has the tools that allow you to write programs that do that.

I will put in a feature request for Alert-Info passthrough as a toggleable option.
It sure would make intercom and some distinctive ring stuff a lot easier if it would do this.

I have been running straight asterisk for about 15 years.
However this is the first time I had to dig a little deeper into it enough
to where it looked anything like “programming” .
Not the end of the world.
I just have to put myself through some scripting basics.
I’m not afraid to work or learn or program as needed.
And I never stop until I figure things out.
Any suggestions on what basics I should be focused on?
Is it just like BASH? or just like some particular flavor of regex?
I’m going with bash for now.
I’m guessing that will get me close and it’s plenty useful for other things I do.
I’m also pretty familiar with a lot of programming concepts and what to do.
It’s just not my everyday hobby or work or interest until it is needed.
Paying other people do do fun things is not any fun.

Just saw your links I will check them out.
This is pretty obviously a simple task once I have a bit more familiarity with the language.

Any such feature request will need to be made against something other than Asterisk (maybe FreePBX?). Asterisk doesn’t accept new features into its formal development process unless they are accompanied by code to implement them. In any case, as noted, Asterisk is a toolkit, and that toolkit already includes the tools needed to implement that feature.

Did the “asterisk is not a PBX it’s a toolkit” mentality change recently?
I have always used it and thought of it as a PBX.
Does this mean I should expect it to not work as a PBX anymore in the future?

Or maybe it never was a PBX and I have just been making it into a PBX and not realizing that.
:slight_smile: