Question on DIALSTATUS

Hello All,

I am trying to use the variable DIALSTATUS to know if the called numbered is busy, answered, has congestion, cancel, etc.

I have created a call file using php to make a call to a number. Now, I am trying to get the status of the called number. I was trying to know the status using the “DIALSTATUS” through the “extensions.conf” but, the DIALSTATUS is always returning a “”(empty string). Can some one help me with this issue.

My Basic application is to call a number and find out if the number is busy, canceled, noanswer, answer. Also please suggest me if some one have any idea to achieve this.

Thanks in Advance,
AMARESH

easy way to do that is use of Local channels. Originate call to a local channel which in turns dials that number you want. That way you can easily get the DIALSTATUS in dialplan.

more about local channels here - voip-info.org/wiki/index.php … l+channels


Godson Gera
Asterisk Consultant India

Hello godson,

Thank you very much for posting me the reply. I tried to use Local channel in my call file
My call file is as described below:

Channel: LOCAL/123@newamar/n
CallerID: 456456
MaxRetries: 0
RetryTime: 9
WaitTime: 12
Context: newamar
Extension: s
Priority: 1
Setvar: SOUND=/var/www/push/sound/CallMeBackUS
Setvar: DESTINATION=7865210317
Setvar: OPERATOR=vitel-outbound

and my extensios.conf file is :
[newamar]
exten => 123,1,Dial(SIP/${DESTINATION}@${OPERATOR})
exten => 123,n,NoOp(${DIALSTATUS})
exten => 123,n,Answer
exten => 123,n,Hangup
exten => s,1,NoOp(${DIALSTATUS})
exten => s,n,Hangup

But I am unable to get the dial status. Can you please inform where I am doing wrong.

Thanks,
Amaresh

In the above dialplan I see that you are trying to get DIALSTATUS at two different locations. Of those two which DIALSTATUS you are not getting ?


Godson Gera
Asterisk Support Services

Hello,

I am not getting the dial status at both the places.

Can you please explain me, what happens exactly when the above call file is seen by the asterisk server.

What I understand is when asterisk sees
Channel: LOCAL/123@newamar/n

it goes to the extensions.conf and finds the corresponding the extension and context and then executes the dial plan.

Is it correct.

Can you please help me with this.

Thanks,
Amaresh

Yes thats correct, Asterisk aggressively monitors the spool directory for call files. Whenever it sees a call file there it goes a head and places the call as instructed. In this case it finds the extension number matching with the context specified. The recommended way of doing it is to create the file else where and copy it to the spool directory otherwise asterisk may pickup the file while you are still creating it in the spool directory.

When this call file is place in spool what do you see on console ?


Godson Gera
Asterisk Consultant

When I placed my call file in /var/spool/outgoing i am getting the following description in my console:

– Attempting call on LOCAL/123@newamar/n for 124@newamar:1 (Retry 1)
– Executing [123@newamar:1] Dial(“Local/123@newamar-8e8f,2”, “SIP/7865210317@vitel-outbound”) in new stack
– Called 7865210317@vitel-outbound
– SIP/vitel-outbound-006648b0 is ringing
– SIP/vitel-outbound-006648b0 is making progress passing it to Local/123@newamar-8e8f,2
– SIP/vitel-outbound-006648b0 answered Local/123@newamar-8e8f,2

Channel Local/123@newamar-8e8f,1 was answered.
== Starting Local/123@newamar-8e8f,1 at newamar,124,1 failed so falling back to exten ‘s’
== Starting Local/123@newamar-8e8f,1 at newamar,s,1 still failed so falling back to context ‘default’
[Dec 30 14:19:39] WARNING[2899]: pbx.c:2470 __ast_pbx_run: Channel ‘Local/123@newamar-8e8f,1’ sent into invalid extension ‘s’ in context ‘default’, but no invalid handler
[Dec 30 14:19:39] NOTICE[2899]: pbx_spool.c:365 attempt_thread: Call completed to LOCAL/123@newamar/n
== Spawn extension (newamar, 123, 1) exited non-zero on ‘Local/123@newamar-8e8f,2’

are you using different call file and contexts from the above posted ones?

cause I don’t see 124 extension in call file as well as context which you have posted above.


Godson Gera
Asterisk Consultant India