best way to make many simultaneous calls

Hi, What is the best method for making 100's of simultaneous calls using Asterisk (i am running 1.6.0.9 on Ubuntu 8.10) Currently, I am using Asterisk Manager Interface (AMI) through webservice calls but it seems awefully slow. Thanks for any tips.
jellydogAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ron MalmsteadInformation Services ManagerCommented:
Have you looked at using call files ?
http://www.voip-info.org/tiki-index.php?page=Asterisk+auto-dial+out

You can also generate calls using the AMI, without a web interface.....I guess it depends on how you have things setup as to which solution is best for you.  Can you give a more detailed description of your setup ?....

0
jellydogAuthor Commented:
I have tried .call files and it seems slow. I would put 50 call files in the /outgoing directory and my server would pick up about 5 or 6 of them at a time and as those calls completed, it would pick up another .call file. I was getting results of >3.5 minutes for it to process the 50 calls. I have already confirmed with my voip provider that I have hundreds of channels available to me.
Most recently, I have been using AMI and passing the Originate command (using URL with rawman?  parameters) which seems to work but fear the http overhead will bite me when trying to make many calls. Also, this approach seems to have a show-stopper. The Originate action implies a Dial() app and since I need to set some CDR values BEFORE the Dial() takes place, Originate does not allow for this. I also need to make decisions based on DIALSTATUS. For instance, if I pass info using Originate and number dialed is BUSY, the call never enters my dialplan context where I set and evaluate Dialstatus and CDR values.  If a line is BUSY, my voip provider just sends a message back to my server and the context in my dialplan is never entered into. I cannot figure out another way to enter the dialplan via AMI - Originate seems to be the only way in. Is there another way?

I am now looking into using FastAGI. Thanks for your help.
0
Ron MalmsteadInformation Services ManagerCommented:
You can use a tcp connection to the AMI as well....also, the orginate command does support channel variables that you can set.

Try this as a test...

Create a call file the same way you would as if you were going to drop it into a the spool directory... but with logon parameters....
Example..
---------------------------------------
action: login
username: myamiusername
secret: myuniquepassword
events: off

Action: Originate
Channel: zap/g1/XXXXXXXXXX
Context: default
Exten: 3307
Priority: 1
Callerid: 5555555555
Timeout: 30000
Variable: CDRvar1=3307|zapchan=SIP/3108


---------------------------------make sure to include the two empty lines after the last line, which denotes the "return"...
Save the file as originate.txt on your c:

Now...
Download NetCat,..."nc.exe" to your c:\


Now try this at command line from the root of C:\

nc.exe 192.168.0.XXX 5038 < originate.txt
--------------------------------------------------------------------------

This method was used for our test application, before we moved to a purely winsock connection to the AMI.

"ConMan" is an asterisk connection manager API, for the AMI, that is useful for developing applications that utilize asterisk. http://www.voip-info.org/wiki/view/Asterisk+Connection+Manager


0
Powerful Yet Easy-to-Use Network Monitoring

Identify excessive bandwidth utilization or unexpected application traffic with SolarWinds Bandwidth Analyzer Pack.

Ron MalmsteadInformation Services ManagerCommented:
0
jellydogAuthor Commented:
Thanks, that example works. However, I need to track (DIALSTATUS) and call files nor Originate command set that value. It seems to only get set when I use the Dial() app. If I run Dial() in my context, I am then placing a second call because the Call file already invoked the call before entering the dialplan. I am trying to do something like this (below) but cannot figure out how I can do this since call files and Originate already dialed the number.

thnaks.

http://www.voip-info.org/wiki/view/Asterisk+dial+plan+-+working+example (see macro-dial-sip)

macro-dial-sip]
;
;
;      Enter with these
;            ARG1 = number to dial
;            ARG2 = timeout value
;            ARG3 = flag determines if hangup or return on no answer
;                  HR = hangup and return (default)
;                  RT = return without hangup (must set)
;
;      Returns with FOUNDME = DIALSTATUS
;
 exten => s,1,SetGlobalVar(FOUNDME=ANSWER)
 exten => s,2,Dial(SIP/${ARG1}${SIPCO1},${ARG2})
 exten => s,3,SetGlobalVar(FOUNDME=${DIALSTATUS})
 exten => s,4,Goto(s-${DIALSTATUS},1)
;
;      returns here if busy
;
 exten => s,103,SetGlobalVar(FOUNDME=BUSY)
 exten => s,104,Goto(s-BUSY,1)
;
 exten => s-BUSY,1,BackGround(the-party-you-are-calling)
 exten => s-BUSY,2,BackGround(is-curntly-busy)
 exten => s-BUSY,3,SetGlobalVar(FOUNDME=BUSY)
 exten => s-BUSY,4,Goto(s-CLEANEXIT,1)
;
 exten => s-CANCEL,1,BackGround(canceled)
 exten => s-CANCEL,2,SetGlobalVar(FOUNDME=CANCEL)
 exten => s-CANCEL,3,Goto(s-CLEANEXIT,1)
;
 exten => s-CHANUNAVAIL,1,BackGround(channel)
 exten => s-CHANUNAVAIL,2,BackGround(is-curntly-unavail)
 exten => s-CHANUNAVAIL,3,SetGlobalVar(FOUNDME=CHANUNAVAIL)
 exten => s-CHANUNAVAIL,4,Goto(s-CLEANEXIT,1)
;
 exten => s-NOANSWER,1,BackGround(nbdy-avail-to-take-call)
 exten => s-NOANSWER,2,SetGlobalVar(FOUNDME=NOANSWER)
 exten => s-NOANSWER,3,Goto(s-CLEANEXIT,1)
;
 exten => s-ANSWER,1,SetGlobalVar(FOUNDME=ANSWER)
 exten => s-ANSWER,2,Goto(s-CLEANEXIT,3)
;
 exten => s-.,1,BackGround(something-Usr2bly-wrong)
 exten => s-.,2,SetGlobalVar(FOUNDME=ERROR)
 exten => s-.,3,Goto(s-CLEANEXIT,1)
;
 exten => s-CLEANEXIT,1,GotoIf($[${ARG3} = RT]?3:2)
 exten => s-CLEANEXIT,2,Hangup
 exten => s-CLEANEXIT,3,NoOp

0
Ron MalmsteadInformation Services ManagerCommented:
The reason is this...

${DIALSTATUS}, gives you the status of the last dial command...and in your case it is this line...
Dial(SIP/${ARG1}${SIPCO1},${ARG2})

So the dialstatus you are pulling is the status of the call placed to the SIP phone...

What you need is to seperate the code for the outbound call...

For example....
Your outgoing call is 5555555555..... so in the dialplan, where you have the pattern matching to send outbound...that is where you would be chekcing the dialstatus, before sending it to "S,1"...

Does that make sense ?
0
jellydogAuthor Commented:
Thank you, that does make sense. I tried some things but still stuck - when I echo {DIALSTATUS} from the [outbound] context, it is blank. Here is what I have (and thanks again for looking and helping me out)


callfile-
channel: SIP/1212XXXXXXX@flowroute ;my voip provider defined in sip.conf
context: outbound
extension: s
priority: 1

dialplan-
[outbound]
exten => +1Nxxxxxxxxx,1,Dial(SIP/${EXTEN}${SIPCO1})
exten => s,1,Set(FOUNDME=${DIALSTATUS})
exten => s,2,NoOP(dialstatus is ${DIALSTATUS}
exten => s,3,Goto(s-${DIALSTATUS})

CLI Output-
    -- Attempting call on SIP/1212XXXXXXX@flowroute for s@outbound:1 (Retry 1)
  == Using SIP RTP CoS mark 5
       > Channel SIP/flowroute-0826ac00 was answered.
    -- Executing [s@outbound:1] Set("SIP/flowroute-0826ac00", "FOUNDME=") in new stack
    -- Executing [s@outbound:2] NoOp("SIP/flowroute-0826ac00", "dialstatus is ") in new stack
0
jellydogAuthor Commented:
I do realize the typo in the pattern matching where "+" should be an underscore. Also the missing closing parenthesis on the NoOP line. My code is correct and same results. Thanks.
0
Ron MalmsteadInformation Services ManagerCommented:
"coolleomod: A message has been sent to some of our more experienced experts asking them to review your question. We will check back again to see if you are getting the help you need."

what's that supposed to mean ?....   I have the most points in Asterisk for this year....
Over zealous mod ?
----------------------------------------------------------------------------------------------------------------------

Ok JellyDog...

if you could post the entire contents of your extensions.conf file...that would help a lot.  Also the sip.conf file leaving out any password and IP information if you could.

This is what I think it should look like...

[outbound]
exten => _1NXXNXXXXXX,1,Dial(SIP/${EXTEN}${SIPCO1},30)
exten => _1NXXNXXXXXX,n,Set(__MYDIALSTATUS=${DIALSTATUS}) ;optional - used for inheritence
exten => _1NXXNXXXXXX,n,NoOP(Dial Status: ${DIALSTATUS})
exten => _1NXXNXXXXXX,n,Goto(call-${DIALSTATUS})
exten => _1NXXNXXXXXX,n (call-ANSWER), Goto(????); send to ? if answered
exten => _1NXXNXXXXXX,n (call-NOANSWER), Goto(????) ;send to  ? if not answered
exten => _1NXXNXXXXXX,n (call-BUSY), Goto(????) ;send to ? if busy
exten => _1NXXNXXXXXX,n (call-CANCEL),Goto(????);callee hungup before connected
exten => _1NXXNXXXXXX,n (call-), Goto(s-NOANSWER) ;no status was set so default to not answered

...in the Goto(???)....you need to fill those in for yourself according to where you want it to go in the dialplan...    

Additionally,...${MYDIALSTATUS} you would need if you are connecting this call into another context within the dialplan where you are going to reference the status of the originated call.



0
Ron MalmsteadInformation Services ManagerCommented:
I have a space before the goto's....you will need to check this for syntax, since it was written "on the fly" without testing.
0
jellydogAuthor Commented:
Hi - and thanks so much for getting back. I am posting everything and you can see that the console output indicates the call gets "dialed" before the Dial() app defined in my context. It must be because of the way sipconf and call file are set up. Here it all is attached. Please correct me where I went awry... :)


SIP.CONF
[general]
disallow=all
allow=ulaw
allow=g729
register => myname:mysecret@70.137.153.130
 
[1000]
type=friend
host=dynamic
context=phones
secret=1000
 
[flowroute]
type=friend
secret=mysecret
username=myname
host=sip.flowroute.com
dtmfmode=rfc2833
context=outbound
qualify=yes
canreinvite=no
allow=ulaw
allow=g729
insecure=port,invite
----------------------------------
DIALPLAN
[general]
clearglobalvars=yes
autofallthrough=no
 
[global]
SIPCO1=@flowroute
 
[default]
exten => s,1,Verbose(1|Unrouted call handler)
exten => s,n,Answer()
exten => s,n,Wait(1)
exten => s,n,Playback(tt-weasels)
exten => s,n,Hangup()
 
[inbound]
exten => s,1,Answer()
exten => s,n,Playback(hello-world)
exten => s,n,Hangup()
 
[internal]
exten => 1000,1,Verbose(1|Extension 1000)
exten => 1000,n,Dial(SIP/1000,30)
exten => 1000,n,Hangup()
 
[msgaccept]
exten => s,1,Playback(outboundmsgs/thankyouaccept)
exten => s,2,Playback(vm-goodbye)
exten => s,3,Hangup()
 
[msgdecline]
exten => s,1,Playback(outboundmsgs/thankyoudecline)
exten => s,2,Playback(vm-goodbye)
exten => s,3,Hangup()
 
[human]
exten => s,1,Playback(outboundmsgs/hellomark)
exten => s,2,Background(outboundmsgs/how_to_ack)
 
exten => 1,1,Goto(msgaccept,s,1) ;pressed 1 accepted
exten => 2,1,Goto(msgdecline,s,1) ;pressed 2 declined
exten => 3,1,Goto(s,1) ;replay msg
 
exten => i,1,Playback(pbx-invalid)
exten => i,n,Goto(s,1)
 
[visit]
exten => s,1,Wait(2)
exten => s,2,Playback(outboundmsgs/nonhuman)
exten => s,3,Playback(vm-goodbye)
exten => s,4,Hangup()
 
[outbound]
exten => _1NXXNXXXXXX,1,Dial(SIP/${EXTEN}${SIPCO1},30)
exten => _1NXXNXXXXXX,n,Set(__MYDIALSTATUS=${DIALSTATUS}) ;optional - used for $
exten => _1NXXNXXXXXX,n,NoOP(Dial Status: ${DIALSTATUS})
exten => _1NXXNXXXXXX,n,Goto(call-${DIALSTATUS})
exten => _1NXXNXXXXXX,n (call-ANSWER),Goto(detect,s,1) ; send to [detect] if an$
exten => _1NXXNXXXXXX,n (call-NOANSWER),Goto(noanswer,s,1) ;send to [noanswer] $
exten => _1NXXNXXXXXX,n (call-BUSY),Goto(busy) ;send to [busy] if busy
exten => _1NXXNXXXXXX,n (call-CANCEL),Goto(cancel);callee hungup before connect
exten => _1NXXNXXXXXX,n (call-CHANNELUNAVAIL),Goto(cancel)$
exten => _1NXXNXXXXXX,n (call-),Goto(s-NOANSWER) ;no status was set so default $
 
[detect]
exten => s,1,Set(TIMEOUT(digit)=5)
exten => s,n,Set(TIMEOUT(response)=10)
exten => s,n,BackgroundDetect(silence/3,1000,50)
exten => s,n,Verbose(3,answering machine detected)
exten => s,n,Set(MACHINE=1)
exten => s,n,BackgroundDetect(silence/10,1000,50,30050)
exten => s,n,NoOp(too long of a message)
exten => s,n,Set(CDR(callresult)=messagetoolong)
exten => s,n,Hangup()
 
exten => talk,1,GotoIf($[${MACHINE}=1]?2:3)
exten => talk,2,Goto(visit,s,1)       ; this is a machine
exten => talk,3,Goto(human,s,1)       ; this is a human
 
[noanswer]
exten => s,1,Set(CDR(accountcode)=${EXTEN})
exten => s,n,Set(CDR(callresult)=No Answer)
exten => s,n,Hangup()
 
[busy]
exten => s,1,Set(CDR(accountcode)=${EXTEN})
exten => s,n,Set(CDR(callresult)=Busy)
exten => s,n,Set(CDR(priorityretry)=1)
exten => s,n,Hangup()
 
[cancel]
exten => s,1,Set(CDR(accountcode)=${EXTEN})
exten => s,n,Set(CDR(callresult)=Canceled)
exten => s,n,Hangup()
 
-----------------------------
CALL FILE
Channel: SIP/12125551212@flowroute
Callerid: 1000
Context: outbound
Extension: 12125551212
Priority: 1
-----------------------------
CONSOLE
ubuntu*CLI>
    -- Attempting call on SIP/12125551212@flowroute for 12125551212@outbound:1 (Retry 1)
  == Using SIP RTP CoS mark 5
       > Channel SIP/flowroute-0870ce10 was answered.
    -- Executing [12125551212@outbound:1] Dial("SIP/flowroute-0870ce10", "SIP/12125551212,30") in new stack
  == Using SIP RTP CoS mark 5
[Jun  4 13:28:38] WARNING[29798]: chan_sip.c:4181 create_addr: No such host: 12125551212
[Jun  4 13:28:38] WARNING[29798]: app_dial.c:1450 dial_exec_full: Unable to create channel of type 'SIP' (cause 20 - Unknown)
  == Everyone is busy/congested at this time (1:0/0/1)
    -- Executing [12125551212@outbound:2] Set("SIP/flowroute-0870ce10", "__MYDIALSTATUS=CHANUNAVAIL") in new stack
    -- Executing [12125551212@outbound:3] NoOp("SIP/flowroute-0870ce10", "Dial Status: CHANUNAVAIL") in new stack
    -- Executing [12125551212@outbound:4] Goto("SIP/flowroute-0870ce10", "call-CHANUNAVAIL") in new stack

Open in new window

0
Ron MalmsteadInformation Services ManagerCommented:
Your call file is connecting the number..."to itself"....

Should look something like this...

Channel: SIP/12125551212@flowroute
Callerid: 1000
Context: Phones
Extension: 1000
Priority: 1

That would pass the completed call to extension 1000...
Although I assume you want to pass a completed call off to [detect]....or "something"..

Give me a little while...I have to run out for a minute,...I look at this tonight and test it on my test box.

I think you are 90% there with the dialplan logic....just gonna be a matter of working out the kinks.
As you can see from the CLI, the dialstatus is getting set....but it was "chanunavail" since the channel was trying to connect to an extension based on the same number.
0
jellydogAuthor Commented:
That is great news, you rock! thanks so much for the help!
0
jellydogAuthor Commented:
You're right in that I need to pass the the completed call to [detect], not an extension. Please let me know if you were able to test out a scenario where that would work. Thanks!!
0
Ron MalmsteadInformation Services ManagerCommented:
I didn't have a chance to test last night, I some of my own issues I had to work on.
After putting some thought into it however, I think it needs to be restructured to accomplish your goal.
Here's what I would like you to try(after you make a backup of your extensions.conf), because i'm doing something similar to this already...

First we create a "system" context...which will hold an arbitrary extension...This extension does nothing except help place the call and allow at least 10 seconds to everything else to happen.

[system]
exten => sys,1,Answer()
exten => sys,n,Wait(10) ; This time should be more than the total time to evaluate the call.
exten => sys,n,Hangup()

Next, the call file is going to use the system extension which only serves to help place the call....10 seconds should be more than enough to evaluate the call whether answered or not...and the detection process...

Channel: SIP/12125551212@flowroute
Callerid: 1000
Context: system
Extension: sys
Priority: 1


Try this, and post the CLI output.
0
Ron MalmsteadInformation Services ManagerCommented:
PS:...once you get the DIALSTATUS working, and the detect working....you should Transfer() to the IVR that will play the message, and allow the calee to press options.  This will disconnect the "sys" extention from the process and put the caller into the ivr...otherwise after 10 seconds the would be disconnected.
0
jellydogAuthor Commented:
Hi, I think I am back to square one again. Dialstatus never gets set because I am not issuing the Dial() app. It only ever seems to have a value when I have Dial() in my dialplan. After adding the [system] context, I just get 10 seconds of silence and then it hangs up. I tried adding my dialstatus evaluation code before and after the Answer() in [system], but dialstatus still never gets set.
0
jellydogAuthor Commented:
this is the CLI output and last version of [system]:
ubuntu*CLI>
    -- Attempting call on SIP/12125551212@flowroute for sys@system:1 (Retry 1)
  == Using SIP RTP CoS mark 5
       > Channel SIP/flowroute-09f940a8 was answered.
    -- Executing [sys@system:1] NoOp("SIP/flowroute-09f940a8", "dialstatus is ") in new stack
    -- Executing [sys@system:2] Answer("SIP/flowroute-09f940a8", "") in new stack
    -- Executing [sys@system:3] NoOp("SIP/flowroute-09f940a8", "dialstatus is ") in new stack
    -- Executing [sys@system:4] Goto("SIP/flowroute-09f940a8", "call-") in new stack
[Jun  6 12:53:14] NOTICE[6770]: pbx.c:3230 pbx_extension_helper: No such label 'call-' in extension 'sys' in context 'system'
[Jun  6 12:53:14] WARNING[6770]: pbx.c:8942 pbx_parseable_goto: Priority 'call-' must be a number > 0, or valid label
  == Spawn extension (system, sys, 4) exited non-zero on 'SIP/flowroute-09f940a8'
-------------------------------
[system]
exten => sys,1,NoOP(dialstatus is ${DIALSTATUS})
exten => sys,n,Answer()
;exten => sys,n,Wait(10)
exten => sys,n,NoOP(dialstatus is ${DIALSTATUS})
exten => sys,n,Goto(call-${DIALSTATUS})
exten => sys,n,(call-ANSWER),Goto(detect,s,1) ; send to [detect] if an$
exten => sys,n,(call-NOANSWER),Goto(noanswer,s,1) ;send to [noanswer] $
exten => sys,n,(call-BUSY),Goto(busy) ;send to [busy] if busy
exten => sys,n,(call-CANCEL),Goto(cancel);callee hungup before connect$
exten => sys,n,(call-CHANNELUNAVAIL),Goto(cancel)
exten => sys,n,(call-),Goto(s-NOANSWER) ;no status was set so default $
exten => sys,n,Wait(10)
exten => sys,n,Hangup()

0
Ron MalmsteadInformation Services ManagerCommented:
first, there is a syntax error on your labels.
this....
exten => sys,n,(call-),Goto(s-NOANSWER) ;no status was set so default $
should be...
exten => sys,n(call-),Goto(s-NOANSWER) ;no status was set so default $
So take out the comma's...

Also, these goto expressions should be in the outbound context...not the sys.
0
Ron MalmsteadInformation Services ManagerCommented:
[outbound]
exten => _1NXXNXXXXXX,1,Dial(SIP/${EXTEN}${SIPCO1},30)
exten => _1NXXNXXXXXX,n,Set(__MYDIALSTATUS=${DIALSTATUS}) ;optional - used for inheritence
exten => _1NXXNXXXXXX,n,NoOP(Dial Status: ${DIALSTATUS})
exten => _1NXXNXXXXXX,n,Goto(call-${DIALSTATUS})
exten => _1NXXNXXXXXX,n(call-ANSWER),Goto(detect,s,1); send to ? if answered
exten => _1NXXNXXXXXX,n(call-NOANSWER),Goto(noanswer,s,1) ;send to  ? if not answered
exten => _1NXXNXXXXXX,n(call-BUSY),Goto(busy,s,1) ;send to ? if busy
exten => _1NXXNXXXXXX,n(call-CANCEL),Goto(cancel,s,1);callee hungup before connected
exten => _1NXXNXXXXXX,n(call-),Goto(s-NOANSWER) ;no status was set so default to not answered
exten => _1NXXNXXXXXX,n,Hangup()
Try with these changes...

;=============system context

[system]
exten => sys,1,Answer()
exten => sys,n,Wait(10) ; This time should be more than the total time to evaluate the call.
exten => sys,n,Hangup()


;=============results
;the detect needs some work,
[detect]
exten => s,1,Set(TIMEOUT(digit)=5)
exten => s,n,Set(TIMEOUT(response)=10)
exten => s,n,BackgroundDetect(silence/3,1000,50)
exten => s,n,Verbose(3,answering machine detected)
exten => s,n,Set(MACHINE=1)
exten => s,n,BackgroundDetect(silence/10,1000,50,30050)
exten => s,n,NoOp(too long of a message)
exten => s,n,Set(CDR(callresult)=messagetoolong)
exten => s,n,GotoIf($[${MACHINE}=1]?machines:humans)
exten => s,n(machines),Goto(visit,s,1)       ; this is a machine
exten => s,n(humans),Goto(human,s,1)       ; this is a human
exten => s,n,Hangup()
 
[msgaccept]
exten => s,1,Playback(outboundmsgs/thankyouaccept)
exten => s,2,Playback(vm-goodbye)
exten => s,3,Hangup()
 
[msgdecline]
exten => s,1,Playback(outboundmsgs/thankyoudecline)
exten => s,2,Playback(vm-goodbye)
exten => s,3,Hangup()
 
[human]
exten => s,1,Playback(outboundmsgs/hellomark)
exten => s,2,Background(outboundmsgs/how_to_ack)
 
exten => 1,1,Goto(msgaccept,s,1) ;pressed 1 accepted
exten => 2,1,Goto(msgdecline,s,1) ;pressed 2 declined
exten => 3,1,Goto(s,1) ;replay msg
 
exten => i,1,Playback(pbx-invalid)
exten => i,n,Goto(s,1)
 
[visit]
exten => s,1,Wait(2)
exten => s,2,Playback(outboundmsgs/nonhuman)
exten => s,3,Playback(vm-goodbye)
exten => s,4,Hangup()

[noanswer]
exten => s,1,Set(CDR(accountcode)=${EXTEN})
exten => s,n,Set(CDR(callresult)=No Answer)
exten => s,n,Hangup()
 
[busy]
exten => s,1,Set(CDR(accountcode)=${EXTEN})
exten => s,n,Set(CDR(callresult)=Busy)
exten => s,n,Set(CDR(priorityretry)=1)
exten => s,n,Hangup()
 
[cancel]
exten => s,1,Set(CDR(accountcode)=${EXTEN})
exten => s,n,Set(CDR(callresult)=Canceled)
exten => s,n,Hangup()


;==========Call file.


Channel: SIP/12125551212@flowroute
Callerid: 1000
Context: system
Extension: sys
Priority: 1
0
jellydogAuthor Commented:
Hi, my initial test was with the goto's in the outbound context. I just moved them when trying different things... With this configuration, my call gets placed and then goes to [system] and sits there for 10 seconds and hangs up. It seems that the call to 12125551212 (actually using my cell number) gets executed before entering the [system] context. Even if I comment out the entire [outbound] context and reload the dialplan, the call still rings my phone with the same result below. It is as if one has no control of the Dial() routine being called by whatever monitors /outgoing dir or Originate requests. Thanks so much keeping on this with me... Is there possibly another conf file involved?

ubuntu*CLI>
    -- Attempting call on SIP/12125551212@flowroute for sys@system:1 (Retry 1)
  == Using SIP RTP CoS mark 5
       > Channel SIP/flowroute-0a06f460 was answered.
    -- Executing [sys@system:1] Answer("SIP/flowroute-0a06f460", "") in new stack
    -- Executing [sys@system:2] Wait("SIP/flowroute-0a06f460", "10") in new stack
    -- Executing [sys@system:3] Hangup("SIP/flowroute-0a06f460", "") in new stack
  == Spawn extension (system, sys, 3) exited non-zero on 'SIP/flowroute-0a06f460'
[Jun  7 11:42:36] NOTICE[24513]: pbx_spool.c:348 attempt_thread: Call completed to SIP/12125551212@flowroute


[general]
clearglobalvars=yes
autofallthrough=no
 
[global]
SIPCO1=@flowroute
 
[default]
exten => s,1,Verbose(1,Unrouted call handler)
exten => s,n,Answer()
exten => s,n,Wait(1)
exten => s,n,Playback(tt-weasels)
exten => s,n,Hangup()
 
[inbound]
exten => s,1,Answer()
exten => s,n,Playback(hello-world)
exten => s,n,Hangup()
 
[internal]
exten => 1000,1,Verbose(1,Extension 1000)
exten => 1000,n,Dial(SIP/1000,30)
exten => 1000,n,Hangup()
 
[phones]
include => internal
include => outbound
 
[system]
exten => sys,1,Answer()
exten => sys,n,Wait(10)
exten => sys,n,Hangup()
 
[msgaccept]
exten => s,1,Playback(outboundmsgs/thankyouaccept)
exten => s,2,Playback(vm-goodbye)
exten => s,3,Hangup()
 
[msgdecline]
exten => s,1,Playback(outboundmsgs/thankyoudecline)
exten => s,2,Playback(vm-goodbye)
exten => s,3,Hangup()
 
[human]
exten => s,1,Playback(outboundmsgs/hellomark)
exten => s,2,Background(outboundmsgs/how_to_ack)
 
exten => 1,1,Goto(msgaccept,s,1) ;pressed 1 accepted
exten => 2,1,Goto(msgdecline,s,1) ;pressed 2 declined
exten => 3,1,Goto(s,1) ;replay msg
 
exten => i,1,Playback(pbx-invalid)
exten => i,n,Goto(s,1)
 
 
[visit]
exten => s,1,Wait(2)
exten => s,2,Playback(outboundmsgs/nonhuman)
exten => s,3,Playback(vm-goodbye)
exten => s,4,Hangup()
 
[outbound]
exten => _1NXXNXXXXXX,1,Dial(SIP/${EXTEN}${SIPCO1},30)
exten => _1NXXNXXXXXX,n,Set(__MYDIALSTATUS=${DIALSTATUS}) ;optional - used for $
exten => _1NXXNXXXXXX,n,NoOP(Dial Status: ${DIALSTATUS})
exten => _1NXXNXXXXXX,n,Goto(call-${DIALSTATUS})
exten => _1NXXNXXXXXX,n (call-ANSWER),Goto(detect,s,1) ; send to [detect] if an$
exten => _1NXXNXXXXXX,n (call-NOANSWER),Goto(noanswer,s,1) ;send to [noanswer] $
exten => _1NXXNXXXXXX,n (call-BUSY),Goto(busy) ;send to [busy] if busy
exten => _1NXXNXXXXXX,n (call-CANCEL),Goto(cancel);callee hungup before connect$
exten => _1NXXNXXXXXX,n (call-CHANNELUNAVAIL),Goto(cancel)
exten => _1NXXNXXXXXX,n (call-),Goto(s-NOANSWER) ;no status was set so default $
exten => _1NXXNXXXXXX,n,Hangup()
 
[detect]
exten => s,1,Set(TIMEOUT(digit)=5)
exten => s,n,Set(TIMEOUT(response)=10)
exten => s,n,Set(MACHINE=0)
exten => s,n,BackgroundDetect(silence/3,1000,50)
exten => s,n,Verbose(3,answering machine detected)
exten => s,n,Set(MACHINE=1)
exten => s,n,BackgroundDetect(silence/10,1000,50,30050)
exten => s,n,NoOp(too long of a message)
exten => s,n,Set(CDR(callresult)=messagetoolong)
exten => s,n,GoToIf($[${MACHINE}=1]?machines:humans)
exten => s,n(machines),Goto(visit,s,1) ;this is a machine
exten => s,n(humans),Goto(human,s,1)   ;this is a human
exten => s,n,Hangup()
 
[noanswer]
exten => s,1,Set(CDR(accountcode)=${EXTEN})
exten => s,n,Set(CDR(callresult)=No Answer)
exten => s,n,Hangup()
 
[busy]
exten => s,1,Set(CDR(accountcode)=${EXTEN})
exten => s,n,Set(CDR(callresult)=Busy)
exten => s,n,Set(CDR(priorityretry)=1)
exten => s,n,Hangup()
 
[cancel]
exten => s,1,Set(CDR(accountcode)=${EXTEN})
exten => s,n,Set(CDR(callresult)=Canceled)
exten => s,n,Hangup()

Open in new window

0
jellydogAuthor Commented:
maybe I am going about this all wrong. I have an automated alert system to which users subscribe. They must enter their phone number into the system. When an alert needs to be sent, my server calls the subscribers and plays the alert message. I need to know if:
1. the call failed (possibly due to thier erroneous entry of thier number, or phone disconnected)
2. the call was answered
3. the line was BUSY (so I can prioritize this callee to get queued to be called again)
4. the call went UNANSWERED (so I can prioritize this callee to get queued to be called again)
5. the call was CANCELED
6. Channel unavailable

My reports are using the CDR tables that get populated with these details. Eventually, items 3 and 4 would be managed inside of the dialplan. Anyway, using DIALSTATUS seemed the way to go - but if there is a better option... ;)
0
Ron MalmsteadInformation Services ManagerCommented:
change the call file to this..

Channel: SIP/12125551212@flowroute
Callerid: 1000
Context: detect
Extension: s
Priority: 1

That will feed all answered calls to detect.


Read this: http://www.voip-info.org/wiki/view/Asterisk+auto-dial+out+deliver+message

0
jellydogAuthor Commented:
Hmmm, that puts me back to what I had originally. We created the [system] context to try and trap the ability to read DIALSTATUS. Prior to that, I was entering the dialplan at [detect]. I read the wiki a while back. Maybe it is just not possible to read DIALSTATUS when using call files or AMI.

You mentioned you had a test system. Have you tried to make a call with a call file and echo dialstatus? (without invoking a second Dial() app?)

Again, I can't thank you enough for helping me.
0
Ron MalmsteadInformation Services ManagerCommented:
You only really need to read the dialstatus if the call IS NOT answered...
If it's answered, you already know it's answered...because the ivr plays.

Place a call, with that call file, and DONT answer the call.  Let's see where the dialplan takes it, and what the dialstatus shows in the CLI.



Also, have you read any of this from the wiki ?

Callfiles and Call Detail Records :
Avoid missing CDR records: Use either a) Context/Extension/Priority in the call file instead of Application/Data, or b) call a Local channel instead of directly calling the desired channel. Else Asterisk will bypass the process that tracks the call and no CDR record will be generated. When using Context/Extension/Priority, you are really using a Goto type function which just puts the call into the correct part of the dialplan and to it is the same as if the caller had dialed the call manually and so the call is logged.

http://www.voip-info.org/wiki/view/Asterisk+local+channels
In Manager API or in a call-file, a CDR will not be generated without using the local channel. At its simplest, use these examples to Dial:


For Manager API or in a call-file use the following to specify an outbound call. (the trailing '/n' is important):

Channel: local/PHONENUMBERTOCALL@outbound/n

And in extensions.conf:

[outbound]
exten => _1.,1,Dial(SIP/${EXTEN}@some-outbound-carrier-context)
exten => _1.,2,Congestion


Maybe you should try using a local channel on the call file ....
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jellydogAuthor Commented:
ok - I think I can make this work. My call file now looks like this:
Channel: local/121255512121@outbound/n
Callerid: 1000
Context: detect
Extension: s
Priority: 1

and my [outbound] captures DIALSTATUS for everything but 'ANSWERED' - which, if it was answered,  I just set a variable=ANSWERED manually in [detect] (as you pointed out :). This does cause multiple CDR records per call, but I think I can live with that.

THANK YOU SO MUCH FOR SEEING THIS THROUGH!!!




0
jellydogAuthor Commented:
Thanks xuserx2000 - You are a Master
0
jellydogAuthor Commented:
Further testing has created a new issue. If I use local/12125551212@outbound/n, then the playback of the file is very choppy and incomprehensive. Switching back to SIP/12125551212@flowroute plays the ivr just fine. Any ideas as to why this would occur? thanks.
0
jellydogAuthor Commented:
I will post this as a new issue. Thanks again.
0
Ron MalmsteadInformation Services ManagerCommented:
cool... I knew we could make it work.

Not sure why using a local channel would make a difference in sound quality...  if I had to guess I would say it probably has something to do with codec transcoding.
0
jellydogAuthor Commented:
What about Transfer() - would that help it? I have not implemented that since I kinda dont understand where to put it. (you mentioned it earlier). What do you think?
0
jellydogAuthor Commented:
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
IP Telephony

From novice to tech pro — start learning today.