[asterisk-users] IAX2: Calls answered before extension is tested?

Alan Lord alanslists at gmail.com
Thu Oct 18 08:36:46 CDT 2007


[Sorry if this arrives more than once. I have sent this twice and it 
never arrived, despite other messages getting to the list O.K.]
-----------

Hello,

I would like an incoming caller to be able to choose from the menu 
options in my extension.conf below. Once They have dialled the 
appropriate digit, * should call two extensions simultaneously: one SIP 
phone on this * server, and one over a working IAX2 link. If either 
party answers, great. If neither party answers or both are 
busy/unavailable go to relevant voicemail box.

This *almost* works... ;-)

The issue is the call that goes down the IAX2 channel always seems to 
get answered, then cleared down almost straight away. It looks like the 
remote * server is accepting the incoming call sending a connected 
message back, thereby completing the Macro, and only *then* checking if 
the extension is actually available.

Here's the last bit of the log (I've edited the IP address) - we are 
both deliberately NOT answering our phones...

  Executing [s at tolc:1] Macro("SIP/101-081d1050", 
"belllord|SIP/101&IAX2/alanb/201|tolc") in new stack
     -- Executing [s at macro-belllord:1] Dial("SIP/101-081d1050", 
"SIP/101&IAX2/alanb/201|10|tr") in new stack
     -- Called 101
     -- Called alanb/201
[Oct 17 16:09:47] WARNING[2836]: channel.c:2634 ast_indicate_data: 
Unable to handle indication 3 for 'SIP/101-081d1050'
     -- SIP/101-081d4fc0 is ringing
     -- Call accepted by 80.XXX.XX.XX (format alaw)
     -- Format for call is alaw
     -- IAX2/alanb-3 answered SIP/101-081d1050
[Oct 17 16:09:47] NOTICE[2836]: cdr.c:434 ast_cdr_free: CDR on channel 
'SIP/101-081d4fc0' not posted
[Oct 17 16:09:47] DEBUG[1419]: chan_iax2.c:7435 socket_process: 
Immediately destroying 3, having received hangup
[Oct 17 16:09:47] DEBUG[2836]: chan_iax2.c:3176 iax2_hangup: We're 
hanging up IAX2/alanb-3 now...
[Oct 17 16:09:47] DEBUG[2836]: chan_iax2.c:3191 iax2_hangup: Really 
destroying IAX2/alanb-3 now...
     -- Hungup 'IAX2/alanb-3'
   == Spawn extension (macro-belllord, s, 1) exited non-zero on 
'SIP/101-081d1050' in macro 'belllord'
   == Spawn extension (macro-belllord, s, 1) exited non-zero on 
'SIP/101-081d1050'

And here's the relevant bits of my extension.conf

[globals]
ALANL=SIP/101 ; My Soft Phone
ALANB=IAX2/alanb/201 ; Alan's Extension

[main_menu] ; Test Dialplan for IVR
exten => s,1,Answer()
exten => s,n,Set(TIMEOUT(digit)=5) ; Max time between digits
exten => s,n,Set(TIMEOUT(response)=15) ; Max time to wait
exten => s,n,Wait(1)
exten => s,n,Background(welcome-to-bell-lord)
exten => s,n(resume),Background(press-3-for-tolc) ; Short dialogues,
exten => s,n,Background(press-4-for-fondoo) ; rather than one long one
exten => s,n,Background(press-5-for-arrowtees) ; might need to change
exten => s,n,Background(press-6-for-gen-enq) ; frequently.
exten => s,n,WaitExten()

exten => 3,1,Goto(tolc,s,1) ; Dial 3 For The Open Learning Centre
exten => 4,1,Goto(fondoo,s,1) ; Dial 4 for Fondoo Internet
exten => 5,1,Goto(arrowtees,s,1) ; Dial 5 for ArrowTees
exten => 6,1,Goto(gen_enq,s,1) ; For all other enquiries press 6

exten => i,1,Playback(pbx-invalid)
exten => i,n,Goto(resume)

exten => t,1,Playback(vm-goodbye)
exten => t,n,Hangup() ; Might change this section to go to [gen_enq] 
voicemail rather than just hangup.

[tolc]
exten => s,1,Macro(belllord,${ALANL}&${ALANB},${CONTEXT}) ; Calls the 
belllord Macro with the channel(s) to dial and the current context (for 
business voicemail)

[fondoo]
exten => s,1,Macro(belllord,${ALANL}&${ALANB},${CONTEXT})

[arrowtees]
exten => s,1,Macro(belllord,${ALANL},${CONTEXT})

[gen_enq]
exten => s,1,Macro(belllord,${ALANL}&${ALANB},${CONTEXT})

; Call with Macro(belllord,channel,vmbox)
[macro-belllord] ; Uses macro and DIALSTATUS for local devices
exten => s,1,Dial(${ARG1},10,tr)
exten => s,n,Goto(s-${DIALSTATUS},1)
exten => s-NOANSWER,1,Voicemail(${ARG2}@business,u) ; business is the 
voicemail context, ${ARG2} is the context from which this call came
exten => s-BUSY,1,Voicemail(${ARG2}@business,b)
exten => _s-.,1,Goto(s-NOANSWER,1)

==============================

Can anyone see where the problem is? Or suggest a better way?

Many thanks.

Alan


-- 
The way out is open!
http://www.theopensourcerer.com

-- 
The way out is open!
http://www.theopensourcerer.com




More information about the asterisk-users mailing list