[asterisk-users] How do I do this?
Steve Totaro
stotaro at first-notification.com
Thu Dec 13 09:23:14 CST 2007
Ade Vickers wrote:
>
>
>
>> -----Original Message-----
>> From: asterisk-users-bounces at lists.digium.com
>> [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of
>> Steve Totaro
>> Sent: 13 December 2007 14:35
>> To: Asterisk Users Mailing List - Non-Commercial Discussion
>> Subject: Re: [asterisk-users] How do I do this?
>>
>>
>> ----- Original Message -----
>> From: "Ade Vickers" <javickers at solutionengineers.com>
>> To: "'Asterisk Users Mailing List - Non-Commercial Discussion'"
>> <asterisk-users at lists.digium.com>
>> Sent: Thursday, December 13, 2007 7:49 AM
>> Subject: [asterisk-users] How do I do this?
>>
>>
>>
>>> I have 2 asterisk servers - serverA and serverC - connected via IAX2.
>>>
>>> On serverA, I have a "telemarketer hold" extension which,
>>>
>> if I transfer a
>>
>>> caller into it, loops around playing music & "please wait"
>>>
>> messages, until
>>
>>> they give up & hang up the phone.
>>>
>>> Also on serverA, I have a custom devstate, which lights a
>>>
>> lamp on a phone
>>
>>> connected to serverA, which tells me if someone is
>>>
>> currently held in that
>>
>>> loop. When they hang up, the devstate is re-set & the lamp goes out.
>>>
>>> On serverC, I have a similar devstate, and a couple of
>>>
>> extensions - one to
>>
>>> turn the lamp on & one to turn it off.
>>>
>>> What happens is this:
>>>
>>> 1) A call arrives @ Asterisk, and calls a phone on serverA,
>>>
>> and a phone on
>>
>>> serverC.
>>> 2) I answer on serverC, determine it's a telemarketer, and
>>>
>> transfer to the
>>
>>> "telemarketer hold" extension on serverA
>>> 3) The call enters the loop, and the devstate is set on
>>>
>> serverA. As it
>>
>>> enters the loop, it calls the "turn on" extension on
>>>
>> serverC, which sets
>>
>>> the
>>> serverC devstate, and hangs up with an "all extensions are
>>>
>> busy" response.
>>
>>> 4) The call, then, stays parked on serverA until the caller
>>>
>> hangs up.
>>
>>> 5) The "h" extension on serverA detects the hangup, and re-sets the
>>> serverA
>>> devstate.
>>> 6) Simultaneously, it calls the "turn off" extension on
>>>
>> serverC, which
>>
>>> re-sets the devstate & returns a "all extensions are busy" response.
>>> 7) serverA then hangs up the call 'officially' by calling Hangup()
>>>
>>> Unfortunately: Step 6 doesn't do anything on serverC... you
>>>
>> can see it
>>
>>> being
>>> executed on serverA, but the call never arrives at serverC.
>>>
>>> I'm guessing this is because the caller has already hung up; so, in
>>> effect,
>>> there's no call to transfer...
>>>
>>> My question, then, is how to get Asterisk to generate a
>>>
>> "new" call, to
>>
>>> tell
>>> serverC to switch off it's lamp?
>>>
>>>
>> Use the h exten? Would you mind sharing more details about
>> your setup such
>> as the dialplan or/or apps you are using? I guess you really hate
>> telemarketers ;-)
>>
>
> Hi Steve,
>
> It's not just telemarketers; I find it's a useful "dumping ground" for any
> caller I don't particularly want to speak to ;)
>
> OK: There are 2 servers involved:
>
> serverA
> - Located in the UK, has a connection to a POTS line via an AX100P card.
> - Handles any 5xxx extension locally, plus a couple of others
> - Talks to serverC via IAX2 channel
> - Running Asterisk v1.4.5 + custom devstate patch
>
> serverC
> - Located in Spain, has only an internet connection
> - Handles any 62xx extension locally, plus the special "teledeath_on" and
> "teledeath_off" extensions
> - Talks to serverA via IAX2 channel
> - Running Asterisk v1.4.11 + custom devstate patch
>
>
>
> So; in serverA, the following bits of the dialplan are relevant:
>
> [default]
> exten => 5555,hint,custom:telepark
>
> ;
> ----------------------------------------------------------------------------
> -
> ; When an internal phone dials, this section defines what happens to the
> calls
> ;
> ----------------------------------------------------------------------------
> -
> [internal]
> ;other destinations cut from here
>
> ;Death to telemarketers
> exten => 5555,1,Goto,teledeath|s|1
>
> [teledeath]
> exten => s,1,Answer()
> exten => s,2,Set(DEVSTATE(Custom:telepark)=INUSE)
> exten => s,3,Dial(IAX2/serverC/teledeath_on)
> exten => s,4,WaitMusicOnHold(15)
> exten => s,5,Wait(1)
> exten => s,6,Playback(pls-hold-while-try)
> exten => s,7,Wait(0.25)
> exten => s,8,Goto,4
>
> exten => h,1,Set(DEVSTATE(Custom:telepark)=NOT_INUSE)
> exten => h,n,Dial(IAX2/serverC/teledeath_off)
> exten => h,n,Hangup()
>
> ; If anything goes wrong, quit the loop
> exten => i,1,Set(DEVSTATE(Custom:telepark)=NOT_INUSE)
> exten => i,n,Dial(IAX2/serverC/teledeath_off)
> exten => i,n,Hangup()
>
> Thus; when I transfer the call to 5555; it jumps into teledeath|s, which
> sets the devstate locally; dials the special extension
> "IAX2/serverC/teledeath_on" to set the serverC busy lamp; then loops around
> music/announcements.
>
> When the caller hangs up, teledeath|h is executed; turning off the local
> lamp & calling "IAX2/serverC/teledeath_off" - which SHOULD turn off the
> serverC lamp, but doesn't - because the call never arrives on serverC...
>
> Here is serverC's extensions.conf file (again, non-pertinent bits removed):
>
> [default]
> exten => 5555,hint,custom:telepark
>
> [internal]
> include => outbound
> include => default
>
> ;Internal phones (local (62xx) & remote (everything else)
> exten => _[57]XXX,1,Goto,external_extensions|6000${EXTEN}|1
>
> ;Death to telemarketers status marker
> exten => teledeath_on,1,Set(DEVSTATE(Custom:telepark)=INUSE)
> exten => teledeath_on,n,Set(HANGUPCAUSE=17)
> exten => teledeath_on,n,Hangup()
>
> exten => teledeath_off,1,Set(DEVSTATE(Custom:telepark)=NOT_INUSE)
> ;exten => teledeath_off,n,Set(HANGUPCAUSE=17)
> ;exten => teledeath_off,n,Hangup()
>
> [external_extensions]
> exten => _6000XXXX,1,Dial(IAX2/serverA/${EXTEN:4},30)
>
> So, here's what happens on serverA:
>
> -- Executing [5555 at internal:1] Goto("IAX2/serverC-2", "teledeath|s|1")
> in new stack
> -- Goto (teledeath,s,1)
> -- Executing [s at teledeath:1] Answer("IAX2/serverC-2", "") in new stack
> -- Executing [s at teledeath:2] Set("IAX2/serverC-2",
> "DEVSTATE(Custom:telepark)=INUSE") in new stack
> Extension Changed 5555 new state InUse for Notify User 5100
> -- Executing [s at teledeath:3] Dial("IAX2/serverC-2",
> "IAX2/serverC/teledeath_on") in new stack
> -- Called serverC/teledeath_on
> -- Call accepted by 88.xxx.xxx.xxx (format ulaw)
> -- Format for call is ulaw
> -- Hungup 'IAX2/serverC-5'
> -- No one is available to answer at this time (1:0/0/0)
> -- Executing [s at teledeath:4] WaitMusicOnHold("IAX2/serverC-2", "15") in
> new stack
> -- Started music on hold, class 'default', on channel 'IAX2/serverC-2'
> -- Channel 'IAX2/serverC-2' unable to transfer
> -- Hungup 'IAX2/serverC-8'
> == Spawn extension (sjs, s, 3) exited non-zero on 'Zap/1-1'
> -- Executing [h at sjs:1] Hangup("Zap/1-1", "") in new stack
> == Spawn extension (sjs, h, 1) exited non-zero on 'Zap/1-1'
> -- Hungup 'Zap/1-1'
> -- Stopped music on hold on IAX2/serverC-2
> == Spawn extension (teledeath, s, 4) exited non-zero on 'IAX2/serverC-2'
> -- Executing [h at teledeath:1] Set("IAX2/serverC-2",
> "DEVSTATE(Custom:telepark)=NOT_INUSE") in new stack
> Extension Changed 5555 new state Idle for Notify User 5100
> -- Executing [h at teledeath:2] Dial("IAX2/serverC-2",
> "IAX2/serverC/teledeath_off") in new stack
> -- Called serverC/teledeath_off
> -- Hungup 'IAX2/serverC-4'
> == Spawn extension (teledeath, h, 2) exited non-zero on 'IAX2/serverC-2'
> -- Hungup 'IAX2/serverC-2'
>
> and, on serverC:
>
> == Spawn extension (internal, 5555, 0) exited non-zero on 'IAX2/serverC-5'
> -- Executing [5555 at internal:1] Goto("IAX2/serverC-5",
> "external_extensions|60005555|1") in new stack
> -- Goto (external_extensions,60005555,1)
> -- Executing [60005555 at external_extensions:1] Dial("IAX2/serverC-5",
> "IAX2/serverA/5555|30") in new stack
> -- Called serverA/5555
> -- Call accepted by 87.xxx.xxx.xxx (format ulaw)
> -- Format for call is ulaw
> -- IAX2/serverA-1 answered IAX2/serverC-5
> -- Accepting AUTHENTICATED call from 87.xxx.xxx.xxx:
> > requested format = ulaw,
> > requested prefs = (ulaw|alaw|gsm),
> > actual format = ulaw,
> > host prefs = (ulaw|alaw|gsm),
> > priority = mine
> -- Executing [teledeath_on at internal:1] Set("IAX2/serverC-2",
> "DEVSTATE(Custom:telepark)=INUSE") in new stack
> -- Executing [teledeath_on at internal:2] Set("IAX2/serverC-2",
> "HANGUPCAUSE=17") in new stack
> -- Executing [teledeath_on at internal:3] Hangup("IAX2/serverC-2", "") in
> new stack
> == Spawn extension (internal, teledeath_on, 3) exited non-zero on
> 'IAX2/serverC-2'
> -- Hungup 'IAX2/serverC-2'
> -- Channel 'IAX2/serverC-5' unable to transfer
> -- Channel 'IAX2/serverA-1' unable to transfer
> -- Hungup 'IAX2/serverA-1'
> == Spawn extension (external_extensions, 60005555, 1) exited non-zero on
> 'IAX2/serverC-5'
> -- Hungup 'IAX2/serverC-5'
>
>
>
> So..... any ideas?
>
>
> Cheers,
> Ade.
>
>
I suppose you could create a new context on server C, include it in your
internal context, and create an h exten on that box to handle it
locally. I am unsure why what you have does not work but I assume the
"unable to transfer" is a hint.
Thanks,
Steve Totaro
More information about the asterisk-users
mailing list