Parallel action / Delay in analog call


#1

Hi Guys,

I am experiencing a delay when receiving an analog call.

I am using a few scripts before the call hit’s my KWS300 SIP / DECT Box and the call on a parallel connected analog Handset rings about twice before the DECT Handset’s do.

I am aware that there is a delay to start the DECT Handset’s ringing but is there a way to action the scripts parallel to calling the SIP Extensions?

My Incoming Rule:

[pstn] exten=>s,1,System(rm -rf /var/www/data.xml) exten=>s,2,System(/var/www/./samsung.pl ${CALLERID(num)}) exten=>s,3,System(php /var/www/soaper.php http://192.168.177.11:52235 < /var/www/data.xml); exten=>s,4,System(curl "http://192.168.177.80:8080/xbmcCmds/xbmcHttp?command=Pause()"); exten=>s,5,Dial(SIP/705&SIP/700&SIP/701&SIP/702&SIP/703&SIP/704&SIP/708&SIP/709,75,Tt) exten=>s,6,VoiceMail(701,u)

Above delete’s a local file and then call’s a PERL Script and then a php script send a uPNP Message to my Samsung TV to signal a Call visually.
The second part then sends a Pause Signal to my Apple TV2 to Pause a Movie or Music

Then the Handset’s are rung

In the console I see:

== Starting post polarity CID detection on channel 3 -- Starting simple switch on 'DAHDI/3-1' [Jan 6 18:24:06] NOTICE[14996]: chan_dahdi.c:8911 ss_thread: Got event 2 (Ring/Answered)... -- Executing [s@pstn:1] System("DAHDI/3-1", "rm -rf /var/www/data.xml") in new stack -- Executing [s@pstn:2] System("DAHDI/3-1", "/var/www/./samsung.pl ") in new stack -- Executing [s@pstn:3] System("DAHDI/3-1", "php /var/www/soaper.php http://192.168.177.11:52235 < /var/www/data.xml") in new stack -- Executing [s@pstn:4] System("DAHDI/3-1", "curl "http://192.168.177.80:8080/xbmcCmds/xbmcHttp?command=Pause()"") in new stack -- Executing [s@pstn:5] Dial("DAHDI/3-1", "SIP/700&SIP/701&SIP/704,75,Tt") in new stack == Using SIP RTP CoS mark 5 == Using SIP VRTP CoS mark 6 -- Called 700 == Using SIP RTP CoS mark 5 == Using SIP VRTP CoS mark 6 -- Called 701 == Using SIP RTP CoS mark 5 == Using SIP VRTP CoS mark 6 -- Called 704 -- SIP/700-00000009 is ringing -- SIP/701-0000000a is ringing -- Got SIP response 480 "Temporarily not available" back from 192.168.177.30 -- SIP/704-0000000b is circuit-busy == Spawn extension (pstn, s, 5) exited non-zero on 'DAHDI/3-1' -- Hungup 'DAHDI/3-1'

Any way to optimize or make the scripting parallel?

THX

Steff


#2

Hello,

I changed the title a bit to reflect that I actually am looking in sending the commands parallel and not wait for it to finish.

Is there a way to get the SIP Phones ring straight away and then action at the same time the additional commands as I got multiple Media Center’s around the House and would like to signal the incoming call / Pause on all of them?

THX

Steff


#3

Since asterisk 1.6, asterisk supports a new type of AGI feature called async agi. This agi runs in the background and after it is launched, dialplan continues to execute. You may need to run all your scripts through the agi and simple run your agi befor dial command. Visit this link for details ofps.oreilly.com/titles/9780596517342/AGI.html

After the change, your dialplan may look like this:

[pstn]
exten=>s,1,AGI(async:myagi.agi)
exten=>s,n,Dial(SIP/705&SIP/700&SIP/701&SIP/702&SIP/703&SIP/704&SIP/708&SIP/709,75,Tt)
exten=>s,n,VoiceMail(701,u)