Paging Cisco Phone - Insert value into SIP Header with PJSIP

Hi everyone - I am having a problem trying to get paging to work on a Cisco phone. The objective of what I am trying to do is allow a Cisco Phone to be paged (i.e., auto pick up the phone when called via page).

When researching this I found I needed to configure the Cisco phone/end point to ensure it had the auto-answer setting set to ‘yes’ – :white_check_mark: this has been done. The Cisco Phones are a third party call control 7841 phone and a third party call control 8861 phone.

I believe the second part of this is I need to insert a value pair into the sip message because this is needed to complete the solution that enables many phones (not just Cisco) to auto-answer. From reading further here (Asterisk Post) and here (Asterisk Documentation) - I need to work in the pre-dial handler - i.e, so I don’t deal with the current sip channel but the one that will be created outbound for the actual page - I have the below so far:

extensions.conf

[handler]

exten => addHeader,1,Set(PJSIP_HEADER(add,Call-Info)=Answer-After=0)

[from-internal]
exten => *60,1,Answer()
exten => *60,n,Page(PJSIP/6002,b(handler^addheader^1))

I wanted to check that this approach was correct to successfully inserting the values (Call-Info)=Answer-After=0) into the outgoing sip session created? I tried to inspect the logs, however, as this was the first time doing this I was not sure where to look or how to check for this as I assume I can inspect this in the logs to check?

I am not 100% sure the value pair (Call-Info)=Answer-After=0) is correct for these phones, however, that is next on my list to check ones I have validated this is the right approach :slight_smile:

Thanks in advances for anyones thoughts around this.

There are many ways to get decent logs with PJSIP.

Otherwise, approach here looks appropriate. Some minor adjustments might include:

  • Adding a Return() line below the Set().
  • Renaming “handler” to “pager” or “pagee”.
  • Matching case between “addHeader” and “addheader”.
  • Trying lower case of “Answer-After”. (Although that is next on your list, as would be adding in more bits eg. <uri>\;answer-after=0)

I don’t know if it’s important, but usually with GoSub, you would call Return when you’re done…

Like so

[handler]

exten => addHeader,1,Set(PJSIP_HEADER(add,Call-Info)=Answer-After=0)
 same => n,Return()

I haven’t seen an implicit Return documented anywhere.

1 Like

@penguinpbx / @Chano - thanks both for your posts, it really helped and this is now working. Also @penguinpbx your last point on adding uri completed the solution - it was not working without this :slight_smile: saved me another post! - here was my final config file for anyone in the future:

extensions.conf

[pager]
exten => addHeader,1,Set(PJSIP_HEADER(add,Call-Info)=<uri>\;answer-after=0) 
same => n,Return()

[from-internal]
exten => *60,1,Answer()
exten => *60,n,Page(PJSIP/${EXTEN},idb(pager^addHeader^1))

I wanted to check two things to ensure everything is as expected. When looking at the logs are these the right lines to confirm the subroutine executed correctly - I am guessing the second line is the confirmation? I was worried about the first line which I think is saying it executed with non-zero (does that indicate an error)? It all works but want to ensure I have captured everything :slight_smile:

 == Spawn extension (pager, addHeader, 2) exited non-zero on 'PJSIP/6002-00000033'
    -- PJSIP/6002-00000033 Internal Gosub(pager,addHeader,1) complete GOSUB_RETVAL=
    -- Called 6002

I think it ended non-zero because you didn’t have a return. A non-zero return is used for successful completion of a dial, so it really means hang up the channel. I don’t know how it behaves in this context, but there is a risk that it will have hungup the outgoing channel.

:+1:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.