SIP Outbound Ring Detection

When we place an outbound call using SIP to my cell phone, asterisk immediately starts processing the dialplan without waiting for the call to be answered. We could handle this on DAHDI using callprogress, but I don’t know of a similar setting for SIP.

Here is the contents of sip.conf:

[general]
allowoverlap=no
bindport=5060
bindaddr=0.0.0.0
srvlookup=yes

register => user399:XXXX@*.*.*.*/***

[sip1]
type=friend
context=users
host=dynamic

[sip_inbound]
type=friend
context=ivr
host=dynamic

[sip_outbound]
username=user399
fromuser=user399
secret=XXXX
fromdomain=*.*.*.*
type=friend
host=*.*.*.*
canreinvite=no
disallow=all
allow=ilbc
allow=g729
allow=gsm
allow=g723
allow=ulaw
call-limit=2

extensions.conf:

[general]
static=yes
writeprotect=no
clearglobalvars=no

[globals]
CONSOLE=Console/dsp                             ; Console interface for demo
IAXINFO=guest                                   ; IAXtel username/password
TRUNK=DAHDI/G0                                    ; Trunk interface
TRUNKMSD=1                                      ; MSD digits to strip (usually 1 or 0)

[outdial]
exten => dial,1,Dial(SIP/912345557890@sipprovider, 45)
exten => dial,n,NoOp(Dial Status = ${DIALSTATUS})
exten => dial,n,Agi(agi://localhost/Outdial.agi)
exten => dial,n,Hangup()

exten => answer,1,NoOp(Dial Status = ${DIALSTATUS})
;exten => answer,n,Playback(start-msg)
exten => answer,n,WaitForSilence(2000)
exten => answer,n,Agi(agi://localhost/Outdial.agi)
exten => answer,n,Hangup()

Thanks.

I am not sure what exactly did you mean by asterisk immediately starts processing the dialplan without waiting for the call to be answered. If asterisk doesn’t process the dialplan, it won’t be able to execute the Dial() function to place the call.

I am not sure what exactly did you mean by asterisk immediately starts processing the dialplan without waiting for the call to be answered. If asterisk doesn’t process the dialplan, it won’t be able to execute the Dial() function to place the call.[/quote]

What I mean is that the Dial command executes and then the dialplan continues on to the next line assuming that the Dial command was answered even though it wasn’t. So, in the case of my extensions.conf:

[outdial]
exten => dial,1,Dial(SIP/912345557890@sipprovider, 45)
exten => dial,n,NoOp(Dial Status = ${DIALSTATUS})
exten => dial,n,Agi(agi://localhost/Outdial.agi)
exten => dial,n,Hangup()

It immediately goes on to the Agi command without waiting for an answer.

[quote=“dericlp”]What I mean is that the Dial command executes and then the dialplan continues on to the next line assuming that the Dial command was answered even though it wasn’t. So, in the case of my extensions.conf:

[outdial]
exten => dial,1,Dial(SIP/912345557890@sipprovider, 45)
exten => dial,n,NoOp(Dial Status = ${DIALSTATUS})
exten => dial,n,Agi(agi://localhost/Outdial.agi)
exten => dial,n,Hangup()

It immediately goes on to the Agi command without waiting for an answer.[/quote]
Can you show the CLI output from the above dialplan context?

Using this Dialplan:

[outdial]
exten => dial,1,NoOp(Dial String = ${DIAL_STRING})
exten => dial,n,NoOp(Dial Timeout = ${DIAL_TIMEOUT})
exten => dial,n,Dial(${DIAL_STRING}, ${DIAL_TIMEOUT})
exten => dial,n,NoOp(Dial Status = ${DIALSTATUS})
exten => dial,n,Agi(agi://localhost/Outdial.agi)
exten => dial,n,Hangup()

exten => answer,1,NoOp(Dial Status = ${DIALSTATUS})
exten => answer,n,Agi(agi://localhost/Outdial.agi)
exten => answer,n,Hangup()

This is what I get:

== Manager 'XXXXXXXX' logged on from 127.0.0.1
    -- Executing [dial@outdial:1] NoOp("Local/dial@outdial-fe23;2", "Dial String = SIP/sip_outbound/912345557890") in new stack
    -- Executing [dial@outdial:2] NoOp("Local/dial@outdial-fe23;2", "Dial Timeout = 45") in new stack
    -- Executing [dial@outdial:3] Dial("Local/dial@outdial-fe23;2", "SIP/sip_outbound/912345557890, 45") in new stack
  == Using SIP RTP CoS mark 5
    -- Called sip_outbound/912345557890
    -- Remote UNIX connection
    -- Remote UNIX connection disconnected
    -- SIP/sip_outbound-00000120 answered Local/dial@outdial-fe23;2
       > Channel Local/dial@outdial-fe23;1 was answered.
    -- Executing [answer@outdial:1] NoOp("Local/dial@outdial-fe23;1", "Dial Status = ") in new stack
    -- Executing [answer@outdial:2] AGI("Local/dial@outdial-fe23;1", "agi://localhost/Outdial.agi") in new stack

You are missing important details. I guess you are using originate with local/dial@ as the channel and answer@ as the extension.

The call is being answered. If there is a problem here, it is with whatever provides the SIP to PSTN interface. However, to be absolutely sure, you should enable SIP debugging and confirm that the call really is being answered prematurely, by the SIP provider.