Outbound call with macro settings doesnt work


I hope you can help me on this. The outbound call placed does well with my softphone (xlite), but when i am using bandtel (Service provider) the call gets established to my mobile phone and when picked the call could not get the audio.

Extract from my asterisk is as shown for differenct scenario’s:

  1. When i use my softphone, you can see the lines in bold which says its ringing and later answered.

Attempting call on Local/outbound@dialout for outbound-handler@dialout:1 (Retry 1)
– Executing [outbound@dialout:1] Answer(“Local/outbound@dialout-2211,2”, “”) in new stack
– Executing [outbound@dialout:2] Wait(“Local/outbound@dialout-2211,2”, “20”) in new stack
– Executing [outbound-handler@dialout:1] Dial(“Local/outbound@dialout-2211,1”, “SIP/102|40|gM(outbound-connect^agi://^—+%0Aname%3A+sanchu%0Aid%3A+1%0A^)”) in new stack
– Called 102
– SIP/102-b75005c0 is ringing
– SIP/102-b75005c0 answered Local/outbound@dialout-2211,1
– Executing [s@macro-outbound-connect:1] Answer(“SIP/102-b75005c0”, “”) in new stack

– Executing [s@macro-outbound-connect:2] NoOp(“SIP/102-b75005c0”, “status=”) in new stack
– Executing [s@macro-outbound-connect:3] Set(“SIP/102-b75005c0”, “CallInitiate_hashdata=—+%0Aname%3A+sanchu%0Aid%3A+1%0A”) in new stack
– Executing [s@macro-outbound-connect:4] Set(“SIP/102-b75005c0”, “machinestatus=”) in new stack
– Executing [s@macro-outbound-connect:5] AGI(“SIP/102-b75005c0”, “agi://”) in new stack
– AGI Script Executing Application: (AGI) Options: (swift.agi|Hi Bhaskar, Welcome to the IVR world. sample Message. This is a reminder set up.)

  1. When i use bandtel to connect to my mobile phone number:

– Attempting call on Local/outbound@dialout for outbound-handler@dialout:1 (Retry 1)
– Executing [outbound@dialout:1] Answer(“Local/outbound@dialout-7829,2”, “”) in new stack
– Executing [outbound@dialout:2] Wait(“Local/outbound@dialout-7829,2”, “20”) in new stack
– Executing [outbound-handler@dialout:1] Dial(“Local/outbound@dialout-7829,1”, “SIP/011919960466622@bandtel_Proxy_Server|40|gM(outbound-connect^agi://^—+%0Aname%3A+sanchu%0Aid%3A+1%0A^)”) in new stack
– Called 011919960466622@bandtel_Proxy_Server
– SIP/proxy1.bandtel.com-b7500b48 is making progress passing it to Local/outbound@dialout-7829,1
– SIP/proxy1.bandtel.com-b7500b48 is ringing
– SIP/proxy1.bandtel.com-b7500b48 is making progress passing it to Local/outbound@dialout-7829,1
– Executing [outbound@dialout:3] NoOp(“Local/outbound@dialout-7829,2”, “”) in new stack

– Executing [outbound@dialout:4] AGI(“Local/outbound@dialout-7829,2”, “agi://”) in new stack
– AGI Script agi:// completed, returning 0
– Executing [outbound@dialout:5] Hangup(“Local/outbound@dialout-7829,2”, “”) in new stack
== Spawn extension (dialout, outbound, 5) exited non-zero on ‘Local/outbound@dialout-7829,2’
[Nov 19 04:31:34] NOTICE[13370]: cdr.c:434 ast_cdr_free: CDR on channel ‘SIP/proxy1.bandtel.com-b7500b48’ not posted
== Spawn extension (dialout, outbound-handler, 1) exited non-zero on ‘Local/outbound@dialout-7829,1’
[Nov 19 04:31:34] NOTICE[13370]: pbx_spool.c:351 attempt_thread: Call completed to Local/outbound@dialout

From the above two scenario you can compare the lines in bold when i connect to softphone and when i connect to my mobile phone where it executes the swift.agi in the former and it gives unanswered at the latter case.

My dialplan is as given below:

exten => outbound,1,Answer                ; switches to outbound-handler
exten => outbound,2,Wait(20)
exten => outbound,3,NoOp(${DIALSTATUS})
exten => outbound,4,AGI(agi://
exten => outbound,6,Hangup

exten => outbound-handler,1,Dial(SIP/${CallInitiate_phonenumber}@bandtel_Proxy_Server,40,gM(outbound-connect^agi://^${CallInitiate_hashdata}^${MACHINE_STATUS_UNKNOWN}))
exten => outbound-handler,2,GotoIf($[${DIALSTATUS} = CONGESTION]?105)
exten => outbound-handler,4,GotoIf($[${DIALSTATUS} = CHANUNAVAIL]?107)
exten => outbound-handler,5,GotoIf($[${DIALSTATUS} = ANSWER]?101)
exten => outbound-handler,6,Set(CallInitiate_hashdata=${CallInitiate_hashdata}) ;DIAL_STATUS is busy, etc.
exten => outbound-handler,7,Goto(104)
exten => outbound-handler,101,AGI(agi://
;exten => outbound-handler,102,Set(CallInitiate_hashdata=${CallInitiate_hashdata})
;exten => outbound-handler,103,AGI(agi://${AGI_SERVER}${AGI_URL}) ;DIAL_STATUS is busy, etc.
exten => outbound-handler,104,Hangup
exten => outbound-handler,105,AGI(agi://
exten => outbound-handler,107,AGI(agi://

exten => s,1,Answer()
exten => s,2,NoOp(status=${DIALSTATUS})
exten => s,3,Set(CallInitiate_hashdata=${ARG2})
exten => s,4,Set(machinestatus=${ARG3})
exten => s,5,AGI(${ARG1})
exten => s,6,Hangup

Could you please let me know what is going wrong here that when i use my service provider the dialplan is not executing macro-outbound-connect.

Thanks and appreciate your response.

Are you behind NAT ?

The server where iam running asterisk is on a public IP. I dont understand whether iam on a nat or not. Please find my sip.conf file below.

I use the service provider to make calls to my mobile number. Got it registered and could establish the call. The problem is only when i pick the call, dialstatus still gives me as “NOANSWER” and does not go to the macro context.

My sip.conf file is as given below:

trustrpid = yes
sendrpid = yes
promiscredir = yes
dtmfmode = rfc2833

;----------------------------------------- OUTBOUND SIP REGISTRATIONS ------------------------

register => 20682xxxxx:password@service.provider.com

;----------------------------------------- NAT SUPPORT ------------------------
; The externip, externhost and localnet settings are used if you use Asterisk
; behind a NAT device to communicate with services on the outside.

;externip = ; Address that we’re going to put in outbound SIP
; messages if we’re behind a NAT

			; The externip and localnet is used
			; when registering and communicating with other proxies
			; that we're registered with

;externhost=foo.dyndns.net ; Alternatively you can specify an
; external host, and Asterisk will
; perform DNS queries periodically. Not
; recommended for production
; environments! Use externip instead
;externrefresh=10 ; How often to refresh externhost if
; used
; You may add multiple local networks. A reasonable
; set of defaults are:
;localnet=; All RFC 1918 addresses are local networks
;localnet= ; Also RFC1918
;localnet= ; Another RFC1918 with CIDR notation
;localnet= ;Zero conf local network

; The nat= setting is used when Asterisk is on a public IP, communicating with
; devices hidden behind a NAT device (broadband router). If you have one-way
; audio problems, you usually have problems with your NAT configuration or your
; firewall’s support of SIP+RTP ports. You configure Asterisk choice of RTP
; ports for incoming audio in rtp.conf
;nat=yes ; Global NAT settings (Affects all peers and users)
; yes = Always ignore info and assume NAT
; no = Use NAT mode only according to RFC3581 (;rport)
; never = Never attempt NAT mode or RFC3581 support
; route = Assume NAT, don’t send rport
; (work around more UNIDEN bugs)


Please help out to solve this. Thanks and appreciate your response.

I can even call you on your number if you can give it me.

My ip address of the system when i use ifconfig is -

Public IP address -

I have the DNS Server addresses as well given by the service providers.

I dont get any support from them, Please help me out.