Dirk-Willem van Gulik
2023-Jul-22 20:51 UTC
[asterisk-users] Parallel dialoog with different Alert-Info headers
We have a couple of parallel ring settings (and this has worked well for eons). Either in the form of same => n,Dial(SIP/1001 & SIP/1002 & SIP/1003 …..) Or via a subroutine (below) that has a bit of extra logic: FOO = 1010 & 1019 & 1017 & 1033 ... same => n,gosub(sub-callout,s,1,(${FOO},”Ringing all class FOO telefons")) Now I have two types of phones (different) era’s that require slightly different Alert-Info headers. How can one introduce a layer of indirection at phone (extension) level that adds those headers ? E.g. something like above 1010 mapping to ; map internal virtual number to the real SIP dial [1010] .. SIPAddHeader(Alert-Info: <http://127.0.0.1>\;info=alert-internal) .. Dail(SIP/2010) But still have the phones all ring in parallel. Any and all suggestions welcome. With kind regards, Dw. [sub-callout] exten => s, 1,Log(NOTICE, Ringing ${ARG2}) same => n,Set(DIALGROUP(allgroup)=) same => n,While($[${LEN(${ARG1})} != 0]) same => n,Set(PEERNAME=${SHIFT(ARG1,&)}) ; Skip any peer that is currently not connected same => n,ExecIf($[0${SIPPEER(${PEERNAME},port)} != 0]?Set(DIALGROUP(allgroup,add)=SIP/${PEERNAME})) same => n,EndWhile() ; Play congestion tone if there are no peers connected in this list same => n,ExecIf($[${LEN(${DIALGROUP(allgroup)})} = 0]?Congestion(10)) same => n,Log(Notice, to ${DIALGROUP(allgroup)}) ; For the 95XX phones; prevent a ‘missed call’ entry. same => n,Set(_CISCO_HUNTPILOT="Ring All" <${EXTEN}>) same => n,Dial(${DIALGROUP(allgroup)},120,ic) same => n,Hangup() same => n,Return()
asterisk at phreaknet.org
2023-Jul-22 21:40 UTC
[asterisk-users] Parallel dialoog with different Alert-Info headers
On 7/22/2023 4:51 PM, Dirk-Willem van Gulik wrote:> We have a couple of parallel ring settings (and this has worked well for eons). > > Either in the form of > > same => n,Dial(SIP/1001 & SIP/1002 & SIP/1003 …..) > > Or via a subroutine (below) that has a bit of extra logic: > > FOO = 1010 & 1019 & 1017 & 1033 > ... > same => n,gosub(sub-callout,s,1,(${FOO},”Ringing all class FOO telefons")) > > Now I have two types of phones (different) era’s that require slightly different Alert-Info headers. > > How can one introduce a layer of indirection at phone (extension) level that adds those headers ?I'm assuming you mean at the device level, and that you want to send only the relevant header to each device? Use pre-dial handlers; a unique handler runs on each destination channel. With PJSIP, you're forced to do this anyways, but SIPAddHeader adds these to the calling channel first, which explains the problem you have now. How you determine the right header to send on each channel is something you still need to do. For example, you could detect the user agent in your pre-dial handler and add the appropriate header. This is a common enough scenario for things like setting the ring cadence that I wrote an application to handle this for me.