Call answered parse to curl


when an incoming call answered by dynamic agent i get a log as below, I want to grep that answered agent and pass it via curl to my url. please suggest on this thanks

– Executing [5056361@from-trunk-sip-synway-vodafone:1] Set(“SIP/synway-vodafone-0000188e”, “cnn=5056361-1246289360-soni”) in new stack
– Executing [5056361@from-trunk-sip-synway-vodafone:2] NoOp(“SIP/synway-vodafone-0000188e”, “5056361-1246289360-soni”) in new stack
– Executing [5056361@from-trunk-sip-synway-vodafone:3] Dial(“SIP/synway-vodafone-0000188e”, “SIP/305,g”) in new stack
– SIP/305-0000188f answered SIP/synway-vodafone-0000188e
– Executing [5056361@from-trunk-sip-synway-vodafone:4] Log(“SIP/synway-vodafone-0000188e”, “NOTICE, Alice call result: ANSWER”) in new stack
– Executing [5056361@from-trunk-sip-synway-vodafone:5] Set(“SIP/synway-vodafone-0000188e”, “CALLERID(num)=50563611246289360”) in new stack
– Auto fallthrough, channel ‘SIP/synway-vodafone-0000188e’ status is ‘ANSWER’
– Executing [h@from-trunk-sip-synway-vodafone:1] Set(“SIP/synway-vodafone-0000188e”, “GROUP()=OUT_5”) in new stack
– Executing [h@from-trunk-sip-synway-vodafone:2] Goto(“SIP/synway-vodafone-0000188e”, “from-trunk,h,1”) in new stack
– Executing [h@from-trunk:1] Macro(“SIP/synway-vodafone-0000188e”, “hangupcall,”) in new stack
– Executing [s@macro-hangupcall:1] GotoIf(“SIP/synway-vodafone-0000188e”, “1?theend”) in new stack
– Executing [s@macro-hangupcall:3] ExecIf(“SIP/synway-vodafone-0000188e”, “0?Set(CDR(recordingfile)=)”) in new stack
– Executing [s@macro-hangupcall:4] Hangup(“SIP/synway-vodafone-0000188e”, “”) in new stack
== Spawn extension (macro-hangupcall, s, 4) exited non-zero on ‘SIP/synway-vodafone-0000188e’ in macro ‘hangupcall’
== Spawn extension (from-trunk, h, 1) exited non-zero on ‘SIP/synway-vodafone-0000188e’

One would normally use AMI, rather than scraping the logs.

Could u pls share some examples of ami and dial plan

When use said agent I was expecting you were using queue() app, in that was the queue, if that the case you can also use the gosub option, if you want to use AMI’s events best easiest way is to use PHP and its fsockopen() function

Hi, i have found the solution but the problem is , getting value after call hangup,

is there any way i can print variables right after call answered

exten => 5056361,1,Answer()
exten => 5056361,n,Dial(SIP/305&SIP/306)
exten => h,1,NoOp( Dial Status: {DIALSTATUS}) exten => h,2,NoOp( Dial Channel: {CHANNEL})
exten => h,3,NoOp(Call_Received_by {BRIDGEPEER}) exten => h,4,NoOp(Call_Unique_ID {UNIQUEID})
exten => h,5,Set(result={SHELL(asterisk -rx "core show channel {CHANNEL}" | grep -i “answer”)})
exten => h,6,NoOp(Call_Duration ${result})
exten => h,7,Hangup

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.