[asterisk-dev] Bug in ${EXTEN} handling in asterisk 1.2.18?

Tony Mountifield tony at softins.clara.co.uk
Fri Jun 15 09:35:41 CDT 2007


In article <30a907f80706150605j7f7156c0mcdfa4fd6ce9f2956 at mail.gmail.com>,
Kegan Holtzhausen <marzubus at gmail.com> wrote:
> correction,
> 
> SIP_EXTENS_0=_76XX

Then you can't use ${SIP_EXTENS_0} as the target of a Goto.
Doing Goto(_76XX,10) makes no sense. It might work, but as
you have discovered, you are now in the extension _76XX rather
than the original one dialled.

If you want to do a goto within the current extension, just give
a priority level and nothing else. So do this instead:

exten => ${SIP_EXTENS_0},1,NoOp("Internal Call to ${EXTEN} from ${CALLERIDNUM}")
exten => ${SIP_EXTENS_0},2,GotoIf($["${CALLERIDNUM}" = "7602"]?5)
exten => ${SIP_EXTENS_0},3,Goto(10)
exten => ${SIP_EXTENS_0},5,Set(_ALERT_INFO=http://10.116.4.8/ringtones/darth1.wav)
exten => ${SIP_EXTENS_0},6,Goto(10)
exten => ${SIP_EXTENS_0},10,noop(ready to connect to extension ${EXTEN})
exten => ${SIP_EXTENS_0},11,Macro(transferReturn_sipdial,${EXTEN},20,${SWITCHBOARD})

Cheers
Tony

> Kegan
> 
> On 6/15/07, Kegan Holtzhausen <marzubus at gmail.com> wrote:
> > I am trying to set _ALERT_INFO based on my from phone number for a
> > test for changing ring-tones based on type of call.
> >
> > What appears to happen is ${EXTEN} in the first noop contains the
> > number I dialed, but at the last step when I hand control over to my
> > Macro(transferReturn_sipdial) the EXTEN variable appears to have
> > changed to the
> > SIP_EXTENS_0 variable.
> >
> > In my extensions.conf I have:
> > Defined a global variable:
> > SIP_EXTENS_0=_7603
> >
> > and in my local_extensions context I have this:
> > exten => ${SIP_EXTENS_0},1,NoOp("Internal Call to ${EXTEN} from ${CALLERIDNUM}")
> > exten => ${SIP_EXTENS_0},2,GotoIf($["${CALLERIDNUM}" =
> > "7602"]?${SIP_EXTENS_0},5)
> > exten => ${SIP_EXTENS_0},3,Goto(${SIP_EXTENS_0},10)
> > exten => ${SIP_EXTENS_0},5,Set(_ALERT_INFO=http://10.116.4.8/ringtones/darth1.wav)
> > exten => ${SIP_EXTENS_0},6,Goto(${SIP_EXTENS_0},10)
> > exten => ${SIP_EXTENS_0},10,noop(ready to connect to extension ${EXTEN})
> > exten => ${SIP_EXTENS_0},11,Macro(transferReturn_sipdial,${EXTEN},20,${SWITCHBOARD})
> >
> > In the CLI I have the following messages:
> >
> >     -- Executing NoOp("SIP/7602-b7b00ce8", ""Internal Call to 7603
> > from 7602"") in new stack
> >     -- SIP Seeding peer from astdb: '7602' at 7602 at 10.116.81.6:2051 for 3600
> >     -- Executing GotoIf("SIP/7602-b7b00ce8", "1?_76XX|5") in new stack
> >     -- Goto (from-sip,_76XX,5)
> >     -- Executing Set("SIP/7602-b7b00ce8",
> > "_ALERT_INFO=http://10.116.4.8/ringtones/darth1.wav") in new stack
> >     -- Executing Goto("SIP/7602-b7b00ce8", "_76XX|10") in new stack
> >     -- Goto (from-sip,_76XX,10)
> >     -- Executing NoOp("SIP/7602-b7b00ce8", "ready to connect to
> > extension _76XX") in new stack
> >     -- Executing Macro("SIP/7602-b7b00ce8",
> > "transferReturn_sipdial|76XX|20|8901") in new stack
> >     -- Executing GotoIf("SIP/7602-b7b00ce8", "0?s|20") in new stack
> >     -- Executing GotoIf("SIP/7602-b7b00ce8", "0?s|20") in new stack
> >     -- Executing Set("SIP/7602-b7b00ce8", "pointer=1") in new stack
> >     -- Executing Set("SIP/7602-b7b00ce8", "called1=76XX") in new stack
> >     -- Executing Set("SIP/7602-b7b00ce8", "called2=0") in new stack
> >     -- Executing Dial("SIP/7602-b7b00ce8", "SIP/76XX|20") in new stack
> > Jun 15 14:33:14 WARNING[26896]: chan_sip.c:1995 create_addr: No such host: 76XX
> > Jun 15 14:33:14 NOTICE[26896]: app_dial.c:1089 dial_exec_full: Unable
> > to create channel of type 'SIP' (cause 3 - No route to destination)
> >   == Everyone is busy/congested at this time (1:0/0/1)
> >     -- Executing Goto("SIP/7602-b7b00ce8", "s-CHANUNAVAIL|1") in new stack
> >     -- Goto (macro-transferReturn_sipdial,s-CHANUNAVAIL,1)
> >     -- Executing VoiceMail("SIP/7602-b7b00ce8", "76XX|ju") in new stack
> >     -- SIP Seeding peer from astdb: '7602' at 7602 at 10.116.81.6:2051 for 3600
> > Jun 15 14:33:14 WARNING[26896]: app_voicemail.c:2461 leave_voicemail:
> > No entry in voicemail config file for '76XX'
> >     -- Executing Playback("SIP/7602-b7b00ce8", "invalid") in new stack
> >     -- Playing 'invalid' (language 'en')
> >   == Spawn extension (macro-transferReturn_sipdial, s-CHANUNAVAIL,
> > 102) exited non-zero on 'SIP/7602-b7b00ce8' in macro
> > 'transferReturn_sipdial'
> >   == Spawn extension (macro-transferReturn_sipdial, s-CHANUNAVAIL,
> > 102) exited non-zero on 'SIP/7602-b7b00
> >
> >
> > Is this something stupid im doing or is it a bug?
> >
> >
> > --
> > Kegan
> >
> > IMPORTANT: This email is intended for the use of the individual
> > addressee(s) and may contain information that is confidential,
> > privileged or unsuitable for overly sensitive persons with low
> > self-esteem, no sense of humour or irrational religious beliefs. If
> > you are not the intended recipient, any dissemination, distribution or
> > copying of this email is not authorised (either explicitly or
> > implicitly) and constitutes an irritating social faux pas. Unless the
> > word absquatulation has been used in its correct context somewhere
> > other than in this warning, it does not have any legal or no
> > grammatical use and may be ignored. No animals were harmed in the
> > transmission of this email. Those of you with an overwhelming fear of
> > the unknown will be gratified to learn that there is no hidden message
> > revealed by reading this warning backwards, so just ignore that Alert
> > Notice from Microsoft.
> >
> > No Microsoft products were used in the transmission of this email.
> >
> 
> _______________________________________________
> --Bandwidth and Colocation provided by Easynews.com --
> 
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-dev
> 


-- 
Tony Mountifield
Work: tony at softins.co.uk - http://www.softins.co.uk
Play: tony at mountifield.org - http://tony.mountifield.org



More information about the asterisk-dev mailing list