Help needed in Originating Call

Hello All,

      I am working on a project of making multiple calls from trixbox but now I am stuck on one place. The system is working fine with multiple calls to softphones but when I make a call to PSTN network it get some wrong status.

Basically I am making calls through PHP code using manager API. I use Originate command to make a call on selected trunk and when the call is answered it bridged the context to that trunk which plays the message to the called party and gives the option to replay the message or confirm it by pressing 1 or 2 keys.

Now what happens when I make call to PSTN network (i.e. Mobile or Landline) the system immediately show the status as answered and pass the control to the context which starts playing message immediately without waiting for the other end to pickup the call. Also if nobody picks up the call it still show the status as answered and deduct money from the users account.

I am very much confused in this matter that how I will find the right status and duration of the call using originate.

Please help me because I have not much time left to make this system working. please forgive me for my poor English.

Ether

how are you connected to the PSTN ? if via an analogue card, you’ll not get answer status unless the line provides answer supervision and your system is configured to use it.

otherwise, Asterisk shows the call as answered the second it’s sent to call to the Zap trunk.

options ? see if your telco provides answer supervision. change your trunk type to one that does provide the call progress you need. change to a SIP/IAX2 provider.

Hello baconbuttie,

   Thanks for your reply. Now I want to tell you that I am using Gizmo Account (Sipphone) as the SIP trunk to make call to the PSTN and Code the Asterisk Manager API in PHP to Originate call from that trunk to the PSTN number and as documentation for the originate command shows that when the call originated by it is answered then the system will pass the control to the context,Extension,Priority which will be given in Context, Extension and Priority clause in Originate Command respectively.

Now what happens that when the coding place the call the system assumes it as answered and pass the control. But I want the system to halt till that moment when the call is originally answered.

Also the system has some abnormal behaviour when the other end cut off the call without receiving. Now have you any idea to do, please help me in this issue. Thanks in Advance. hope for better results in this post because many in World have this problem.

Ether

can you show a log fragment for a call, particularly where it’s showing the call as answered immediately ?

if the ITSP is showing the call as answered, and answer supervision isn’t available for some reason, then you need to find an app that will do “talk detection”, pausing your dialplan until it is detected.

Hello baconbuttie,

     Thanks for your interest in our problem. As you ask for our log fragment for that case. Here I am attaching the log for a call which is never picked up by me, the cell phone is just ringing during this time and my centext is running as it is on answered call.

[ul]Jan 20 00:08:43 VERBOSE[1696] logger.c: == Manager ‘test’ logged on from 127.0.0.1
Jan 20 00:08:44 DEBUG[1696] manager.c: Manager received command ‘Originate’
Jan 20 00:08:44 DEBUG[1696] chan_sip.c: Setting NAT on RTP to 524288
Jan 20 00:08:44 DEBUG[1696] acl.c: ##### Testing 198.65.166.131 with 192.168.40.0
Jan 20 00:08:44 DEBUG[1696] chan_sip.c: Target address 198.65.166.131 is not local, substituting externip
Jan 20 00:08:44 DEBUG[1696] chan_sip.c: Outgoing Call for +91XXXXXXXXXX
Jan 20 00:08:44 DEBUG[2858] chan_sip.c: Acked pending invite 102
Jan 20 00:08:45 DEBUG[2858] chan_sip.c: Acked pending invite 103
Jan 20 00:08:45 DEBUG[2858] chan_sip.c: build_route: Record-Route hop: <SIP:198.65.166.131;FTAG=AS35095825;LR
Jan 20 00:08:45 VERBOSE[1696] logger.c: > Channel SIP/Hr_Gizmo-0866a9a0 was answered.
Jan 20 00:08:45 VERBOSE[1697] logger.c: == Starting SIP/Hr_Gizmo-0866a9a0 at outboundmsg21,ICallTree ,1 failed so falling back to exten ‘s’
Jan 20 00:08:45 VERBOSE[1697] logger.c: – Executing DigitTimeout(“SIP/Hr_Gizmo-0866a9a0”, “5”) in new stack
Jan 20 00:08:45 VERBOSE[1697] logger.c: – Set Digit Timeout to 5
Jan 20 00:08:45 VERBOSE[1697] logger.c: – Executing ResponseTimeout(“SIP/Hr_Gizmo-0866a9a0”, “10”) in new stack
Jan 20 00:08:45 VERBOSE[1697] logger.c: – Set Response Timeout to 10
Jan 20 00:08:45 VERBOSE[1697] logger.c: – Executing Answer(“SIP/Hr_Gizmo-0866a9a0”, “”) in new stack
Jan 20 00:08:45 VERBOSE[1697] logger.c: – Executing Set(“SIP/Hr_Gizmo-0866a9a0”, “DUR1=1169269725”) in new stack
Jan 20 00:08:45 VERBOSE[1697] logger.c: – Executing WaitForSilence(“SIP/Hr_Gizmo-0866a9a0”, “1500|1”) in new stack
Jan 20 00:08:45 VERBOSE[1697] logger.c: – Waiting 1 time(s) for 1500 ms silence
Jan 20 00:08:45 DEBUG[2858] chan_sip.c: build_route: Retaining previous route: <SIP:198.65.166.131;FTAG=AS35095825;LR
Jan 20 00:08:46 DEBUG[1696] manager.c: Manager received command ‘‘
Jan 20 00:08:46 VERBOSE[1696] logger.c: == Manager ‘test’ logged off from 127.0.0.1
Jan 20 00:08:47 WARNING[1697] app_waitforsilence.c: One waitfor failed, trying another
Jan 20 00:08:49 WARNING[1697] app_waitforsilence.c: No audio available on SIP/Hr_Gizmo-0866a9a0??
Jan 20 00:08:49 VERBOSE[1697] logger.c: – Executing BackGround(“SIP/Hr_Gizmo-0866a9a0”, “msg1/greet”) in new stack
Jan 20 00:08:49 DEBUG[1697] channel.c: Scheduling timer at 160 sample intervals
Jan 20 00:08:49 VERBOSE[1697] logger.c: – Playing ‘msg1/greet’ (language ‘en’)
Jan 20 00:08:51 DEBUG[1697] channel.c: Scheduling timer at 0 sample intervals
Jan 20 00:08:51 DEBUG[1697] channel.c: Scheduling timer at 0 sample intervals
Jan 20 00:08:51 VERBOSE[1697] logger.c: – Executing BackGround(“SIP/Hr_Gizmo-0866a9a0”, “msg1/test”) in new stack
Jan 20 00:08:51 DEBUG[1697] channel.c: Scheduling timer at 160 sample intervals
Jan 20 00:08:51 VERBOSE[1697] logger.c: – Playing ‘msg1/test’ (language ‘en’)
Jan 20 00:09:05 DEBUG[2858] acl.c: ##### Testing 198.65.166.131 with 192.168.40.0
Jan 20 00:09:05 DEBUG[2858] chan_sip.c: Target address 198.65.166.131 is not local, substituting externip
Jan 20 00:09:06 DEBUG[2858] acl.c: ##### Testing 198.65.166.131 with 192.168.40.0
Jan 20 00:09:06 DEBUG[2858] chan_sip.c: Target address 198.65.166.131 is not local, substituting externip
Jan 20 00:09:12 DEBUG[2858] acl.c: ##### Testing 198.65.166.131 with 192.168.40.0
Jan 20 00:09:12 DEBUG[2858] chan_sip.c: Target address 198.65.166.131 is not local, substituting externip
Jan 20 00:09:15 DEBUG[1697] channel.c: Scheduling timer at 0 sample intervals
Jan 20 00:09:15 DEBUG[1697] channel.c: Scheduling timer at 0 sample intervals
Jan 20 00:09:15 VERBOSE[1697] logger.c: – Executing BackGround(“SIP/Hr_Gizmo-0866a9a0”, “to-hear-msg-again”) in new stack
Jan 20 00:09:15 DEBUG[1697] channel.c: Scheduling timer at 160 sample intervals
Jan 20 00:09:15 VERBOSE[1697] logger.c: – Playing ‘to-hear-msg-again’ (language ‘en’)
Jan 20 00:09:17 DEBUG[2858] acl.c: ##### Testing 204.147.183.18 with 192.168.40.0
Jan 20 00:09:17 DEBUG[2858] chan_sip.c: Target address 204.147.183.18 is not local, substituting externip
Jan 20 00:09:18 DEBUG[1697] channel.c: Scheduling timer at 0 sample intervals
Jan 20 00:09:18 DEBUG[1697] channel.c: Scheduling timer at 0 sample intervals
Jan 20 00:09:18 VERBOSE[1697] logger.c: – Executing BackGround(“SIP/Hr_Gizmo-0866a9a0”, “press-1”) in new stack
Jan 20 00:09:18 DEBUG[1697] channel.c: Scheduling timer at 160 sample intervals
Jan 20 00:09:18 VERBOSE[1697] logger.c: – Playing ‘press-1’ (language ‘en’)
Jan 20 00:09:19 DEBUG[2858] acl.c: ##### Testing 198.65.166.131 with 192.168.40.0
Jan 20 00:09:19 DEBUG[2858] chan_sip.c: Target address 198.65.166.131 is not local, substituting externip
Jan 20 00:09:19 DEBUG[1697] channel.c: Scheduling timer at 0 sample intervals
Jan 20 00:09:19 DEBUG[1697] channel.c: Scheduling timer at 0 sample intervals
Jan 20 00:09:19 VERBOSE[1697] logger.c: – Executing BackGround(“SIP/Hr_Gizmo-0866a9a0”, “to-confirm-wakeup”) in new stack
Jan 20 00:09:19 DEBUG[1697] channel.c: Scheduling timer at 160 sample intervals
Jan 20 00:09:19 VERBOSE[1697] logger.c: – Playing ‘to-confirm-wakeup’ (language ‘en’)
Jan 20 00:09:20 DEBUG[2858] acl.c: ##### Testing 198.65.166.131 with 192.168.40.0
Jan 20 00:09:20 DEBUG[2858] chan_sip.c: Target address 198.65.166.131 is not local, substituting externip
Jan 20 00:09:21 DEBUG[1697] channel.c: Scheduling timer at 0 sample intervals
Jan 20 00:09:21 DEBUG[1697] channel.c: Scheduling timer at 0 sample intervals
Jan 20 00:09:21 VERBOSE[1697] logger.c: – Executing BackGround(“SIP/Hr_Gizmo-0866a9a0”, “press-2”) in new stack
Jan 20 00:09:21 DEBUG[1697] channel.c: Scheduling timer at 160 sample intervals
Jan 20 00:09:21 VERBOSE[1697] logger.c: – Playing ‘press-2’ (language ‘en’)
Jan 20 00:09:22 DEBUG[1697] channel.c: Scheduling timer at 0 sample intervals
Jan 20 00:09:22 DEBUG[1697] channel.c: Scheduling timer at 0 sample intervals
Jan 20 00:09:25 DEBUG[2858] acl.c: ##### Testing 198.65.166.131 with 192.168.40.0
Jan 20 00:09:25 DEBUG[2858] chan_sip.c: Target address 198.65.166.131 is not local, substituting externip
Jan 20 00:09:26 DEBUG[2858] acl.c: ##### Testing 198.65.166.131 with 192.168.40.0
Jan 20 00:09:26 DEBUG[2858] chan_sip.c: Target address 198.65.166.131 is not local, substituting externip
Jan 20 00:09:32 DEBUG[2858] acl.c: ##### Testing 198.65.166.131 with 192.168.40.0
Jan 20 00:09:32 DEBUG[2858] chan_sip.c: Target address 198.65.166.131 is not local, substituting externip
Jan 20 00:09:33 VERBOSE[1697] logger.c: – Timeout on SIP/Hr_Gizmo-0866a9a0
Jan 20 00:09:33 VERBOSE[1697] logger.c: == CDR updated on SIP/Hr_Gizmo-0866a9a0
Jan 20 00:09:33 VERBOSE[1697] logger.c: – Executing Playback(“SIP/Hr_Gizmo-0866a9a0”, “vm-goodbye”) in new stack
Jan 20 00:09:33 DEBUG[1697] channel.c: Scheduling timer at 160 sample intervals
Jan 20 00:09:33 VERBOSE[1697] logger.c: – Playing ‘vm-goodbye’ (language ‘en’)
Jan 20 00:09:34 DEBUG[1697] channel.c: Scheduling timer at 154 sample intervals
Jan 20 00:09:34 DEBUG[1697] channel.c: Scheduling timer at 0 sample intervals
Jan 20 00:09:34 DEBUG[1697] channel.c: Scheduling timer at 0 sample intervals
Jan 20 00:09:34 VERBOSE[1697] logger.c: – Executing Hangup(“SIP/Hr_Gizmo-0866a9a0”, “”) in new stack
Jan 20 00:09:34 VERBOSE[1697] logger.c: == Spawn extension (outboundmsg21, t, 2) exited non-zero on ‘SIP/Hr_Gizmo-0866a9a0’
Jan 20 00:09:34 DEBUG[1697] pbx.c: Expression result is ‘49’
Jan 20 00:09:34 VERBOSE[1697] logger.c: – Executing Set(“SIP/Hr_Gizmo-0866a9a0”, “DUR1=49”) in new stack
Jan 20 00:09:34 VERBOSE[1697] logger.c: – Executing Curl(“SIP/Hr_Gizmo-0866a9a0”, “http://192.168.40.128/ict/call-end.php|line=1&dur=49”) in new stack
Jan 20 00:09:34 VERBOSE[1697] logger.c: – Executing Hangup(“SIP/Hr_Gizmo-0866a9a0”, “”) in new stack
Jan 20 00:09:34 VERBOSE[1697] logger.c: == Spawn extension (outboundmsg21, h, 3) exited non-zero on ‘SIP/Hr_Gizmo-0866a9a0’
Jan 20 00:09:34 DEBUG[1697] cdr_addon_mysql.c: cdr_mysql: inserting a CDR record.
Jan 20 00:09:34 DEBUG[1697] cdr_addon_mysql.c: cdr_mysql: SQL command as follows: INSERT INTO cdr (calldate,clid,src,dst,dcontext,channel,dstchannel,lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid) VALUES (‘2007-01-20 00:08:45’,’“ICallTree” <17470291446>’,‘17470291446’,‘t’,‘outboundmsg21’, ‘SIP/Hr_Gizmo-0866a9a0’,’’,‘Hangup’,’’,49,49,‘ANSWERED’,3,’’,‘1169269724.10’)
Jan 20 00:09:34 DEBUG[1697] chan_sip.c: update_call_counter(+919415000930) - decrement call limit counter
[/ul]

Also as you suggest to use some “Talk Detection Application”, I want to say that I already tried BackGroundDetect for this purpose but it detect the ring as talk and send the control to the talk extension. Please see about it in http://www.voip-info.org/wiki-Asterisk+cmd+BackGroundDetect. Please Reply me in this context and suggest some ideas to do this work by seeing my log above.

Thanks and Regards

Ether