Asterisk click2call problem

Hello Friends,
I am facing a problem with function click2call from click2call.php script below:

<? #ip address that asterisk is on. $strHost = "localhost"; #specify the username you want to login with (these users are defined in /etc/asterisk/manager.conf) #this user is the default AAH AMP user; you shouldn't need to change, if you're using AAH. $strUser = "admin"; $strSecret = "amp111"; $strChannel = $_GET["operatorNumber"]; $strContext = "from-internal"; $number=strtolower($_REQUEST['outNumber']); $strWaitTime = "30"; $strPriority = "1"; $strMaxRetry = "2"; $pos=strpos ($number,"local"); if ($number == null) : exit() ; endif ; if ($pos===false) : $errno=0 ; $errstr=0 ; $strCallerId = "Agent <$strChannel>"; $oSocket = fsockopen ($strHost, 5038, $errno, $errstr, 20); if (!$oSocket) { echo "$errstr ($errno)
\n"; } else { fputs($oSocket, "Action: login\r\n"); fputs($oSocket, "Events: off\r\n"); fputs($oSocket, "Username: $strUser\r\n"); fputs($oSocket, "Secret: $strSecret\r\n\r\n"); fputs($oSocket, "Action: originate\r\n"); fputs($oSocket, "Channel: SIP/$strChannel\r\n"); fputs($oSocket, "WaitTime: $strWaitTime\r\n"); fputs($oSocket, "CallerId: $strCallerId\r\n"); fputs($oSocket, "Exten: $number\r\n"); fputs($oSocket, "Context: $strContext\r\n"); fputs($oSocket, "Priority: $strPriority\r\n\r\n"); fputs($oSocket, "Action: Logoff\r\n\r\n"); sleep(1) ; fclose($oSocket); } else : exit() ; endif ; ?>

I open asteriskip/click2call.php?outNum … umber=1001 , my Xlite ext 1001 is ringing and answer then it make call to dst 0016175669300, everything seem to be ok but problem here is the calldate of this call in asteriskcdrdb.cdr database is not match the recording file. For example: I click2call this call at around 11:04pm then calldate showing is “2010-08-09 23:04:03” but the recording file is showing “OUT1001-20100809-230407-1281978031.306.wav” and disposition of this call is “NO ANSWER” even of destination number pick up the call and talking. But when I try to dial 0016175669300 manually from Xlite, the calldatetime and calltime are the same (2010-08-09 23:08:09 - OUT1001-20100809-230809-1281978031.308.wav) and status of this call is “ANSWERED”.

I am crazy with this problem and tested in some ways to find solution but nothing.

Anyone can help me?

Appreciate for your help

Thanks

Hi

This script has little to do with the recording filename.

You need to look at the dialplan and also the verbose output of a call.

Ian

Hi ianplain,

Thanks for your reply.
i am using context “from-internal” to originate all calls.

Here is the verbose of the call making from the script.

– Executing [0016175669300@from-internal:1] Macro(“SIP/1001-083c2a18”, “user-callerid|SKIPTTL|”) in new stack
– Executing [s@macro-user-callerid:1] Set(“SIP/1001-083c2a18”, “AMPUSER=1001”) in new stack
– Executing [s@macro-user-callerid:2] GotoIf(“SIP/1001-083c2a18”, “0?report”) in new stack
– Executing [s@macro-user-callerid:3] ExecIf(“SIP/1001-083c2a18”, “1|Set|REALCALLERIDNUM=1001”) in new stack
– Executing [s@macro-user-callerid:4] Set(“SIP/1001-083c2a18”, “AMPUSER=1001”) in new stack
– Executing [s@macro-user-callerid:5] Set(“SIP/1001-083c2a18”, “AMPUSERCIDNAME=ANZ1001”) in new stack
– Executing [s@macro-user-callerid:6] GotoIf(“SIP/1001-083c2a18”, “0?report”) in new stack
– Executing [s@macro-user-callerid:7] Set(“SIP/1001-083c2a18”, “AMPUSERCID=1001”) in new stack
– Executing [s@macro-user-callerid:8] Set(“SIP/1001-083c2a18”, “CALLERID(all)=“ANZ1001” <1001>”) in new stack
– Executing [s@macro-user-callerid:9] ExecIf(“SIP/1001-083c2a18”, “0|Set|CHANNEL(language)=”) in new stack
– Executing [s@macro-user-callerid:10] GotoIf(“SIP/1001-083c2a18”, “1?continue”) in new stack
– Goto (macro-user-callerid,s,19)
– Executing [s@macro-user-callerid:19] NoOp(“SIP/1001-083c2a18”, “Using CallerID “ANZ1001” <1001>”) in new stack
– Executing [0016175669300@from-internal:2] Set(“SIP/1001-083c2a18”, “_NODEST=”) in new stack
– Executing [0016175669300@from-internal:3] Macro(“SIP/1001-083c2a18”, “record-enable|1001|OUT|”) in new stack
– Executing [s@macro-record-enable:1] GotoIf(“SIP/1001-083c2a18”, “1?check”) in new stack
– Goto (macro-record-enable,s,4)
– Executing [s@macro-record-enable:4] ExecIf(“SIP/1001-083c2a18”, “0|MacroExit|”) in new stack
– Executing [s@macro-record-enable:5] GotoIf(“SIP/1001-083c2a18”, “0?Group:OUT”) in new stack
– Goto (macro-record-enable,s,15)
– Executing [s@macro-record-enable:15] GotoIf(“SIP/1001-083c2a18”, “0?IN”) in new stack
– Executing [s@macro-record-enable:16] ExecIf(“SIP/1001-083c2a18”, “0|MacroExit|”) in new stack
– Executing [s@macro-record-enable:17] NoOp(“SIP/1001-083c2a18”, “Recording enable for 1001”) in new stack
– Executing [s@macro-record-enable:18] Set(“SIP/1001-083c2a18”, “CALLFILENAME=OUT1001-20100816-181339-1281957216.242”) in new stack
– Executing [s@macro-record-enable:19] Goto(“SIP/1001-083c2a18”, “record”) in new stack
– Goto (macro-record-enable,s,23)
– Executing [s@macro-record-enable:23] MixMonitor(“SIP/1001-083c2a18”, “OUT1001-20100816-181339-1281957216.242.wav||”) in new stack
– Executing [s@macro-record-enable:24] MacroExit(“SIP/1001-083c2a18”, “”) in new stack
– Executing [0016175669300@from-internal:4] Macro(“SIP/1001-083c2a18”, “dialout-trunk|2|0016175669300||”) in new stack
– Executing [s@macro-dialout-trunk:1] Set(“SIP/1001-083c2a18”, “DIAL_TRUNK=2”) in new stack
– Executing [s@macro-dialout-trunk:2] GosubIf(“SIP/1001-083c2a18”, “0?sub-pincheck|s|1”) in new stack
– Executing [s@macro-dialout-trunk:3] GotoIf(“SIP/1001-083c2a18”, “0?disabletrunk|1”) in new stack
– Executing [s@macro-dialout-trunk:4] Set(“SIP/1001-083c2a18”, “DIAL_NUMBER=0016175669300”) in new stack
– Executing [s@macro-dialout-trunk:5] Set(“SIP/1001-083c2a18”, “DIAL_TRUNK_OPTIONS=tr”) in new stack
– Executing [s@macro-dialout-trunk:6] Set(“SIP/1001-083c2a18”, “OUTBOUND_GROUP=OUT_2”) in new stack
– Executing [s@macro-dialout-trunk:7] GotoIf(“SIP/1001-083c2a18”, “1?nomax”) in new stack
– Goto (macro-dialout-trunk,s,9)
– Executing [s@macro-dialout-trunk:9] GotoIf(“SIP/1001-083c2a18”, “0?skipoutcid”) in new stack
– Executing [s@macro-dialout-trunk:10] Set(“SIP/1001-083c2a18”, “DIAL_TRUNK_OPTIONS=”) in new stack
– Executing [s@macro-dialout-trunk:11] Macro(“SIP/1001-083c2a18”, “outbound-callerid|2”) in new stack
– Executing [s@macro-outbound-callerid:1] ExecIf(“SIP/1001-083c2a18”, “0|SetCallerPres|”) in new stack
– Executing [s@macro-outbound-callerid:2] ExecIf(“SIP/1001-083c2a18”, “0|Set|REALCALLERIDNUM=1001”) in new stack
– Executing [s@macro-outbound-callerid:3] GotoIf(“SIP/1001-083c2a18”, “1?normcid”) in new stack
– Goto (macro-outbound-callerid,s,6)
– Executing [s@macro-outbound-callerid:6] Set(“SIP/1001-083c2a18”, “USEROUTCID=”) in new stack
– Executing [s@macro-outbound-callerid:7] Set(“SIP/1001-083c2a18”, “EMERGENCYCID=”) in new stack
– Executing [s@macro-outbound-callerid:8] Set(“SIP/1001-083c2a18”, “TRUNKOUTCID=0873066668”) in new stack
– Executing [s@macro-outbound-callerid:9] GotoIf(“SIP/1001-083c2a18”, “1?trunkcid”) in new stack
– Goto (macro-outbound-callerid,s,12)
– Executing [s@macro-outbound-callerid:12] ExecIf(“SIP/1001-083c2a18”, “1|Set|CALLERID(all)=0873066668”) in new stack
– Executing [s@macro-outbound-callerid:13] ExecIf(“SIP/1001-083c2a18”, “0|Set|CALLERID(all)=”) in new stack
– Executing [s@macro-outbound-callerid:14] ExecIf(“SIP/1001-083c2a18”, “0|Set|CALLERID(all)=”) in new stack
– Executing [s@macro-outbound-callerid:15] ExecIf(“SIP/1001-083c2a18”, “0|SetCallerPres|prohib_passed_screen”) in new stack
– Executing [s@macro-dialout-trunk:12] ExecIf(“SIP/1001-083c2a18”, “0|AGI|fixlocalprefix”) in new stack
– Executing [s@macro-dialout-trunk:13] Set(“SIP/1001-083c2a18”, “OUTNUM=0016175669300”) in new stack
– Executing [s@macro-dialout-trunk:14] Set(“SIP/1001-083c2a18”, “custom=SIP/fpt-ivoice”) in new stack
– Executing [s@macro-dialout-trunk:15] ExecIf(“SIP/1001-083c2a18”, “0|Set|DIAL_TRUNK_OPTIONS=M(setmusic^)”) in new stack
– Executing [s@macro-dialout-trunk:16] Macro(“SIP/1001-083c2a18”, “dialout-trunk-predial-hook|”) in new stack
– Executing [s@macro-dialout-trunk-predial-hook:1] MacroExit(“SIP/1001-083c2a18”, “”) in new stack
– Executing [s@macro-dialout-trunk:17] GotoIf(“SIP/1001-083c2a18”, “0?bypass|1”) in new stack
– Executing [s@macro-dialout-trunk:18] GotoIf(“SIP/1001-083c2a18”, “0?customtrunk”) in new stack
– Executing [s@macro-dialout-trunk:19] Dial(“SIP/1001-083c2a18”, “SIP/fpt-ivoice/0016175669300|300|”) in new stack
– Called fpt-ivoice/0016175669300
== Begin MixMonitor Recording SIP/1001-083c2a18
– SIP/fpt-ivoice-0830fba8 is making progress passing it to SIP/1001-083c2a18
– SIP/fpt-ivoice-0830fba8 is making progress passing it to SIP/1001-083c2a18
– SIP/fpt-ivoice-0830fba8 answered SIP/1001-083c2a18
== Spawn extension (macro-dialout-trunk, s, 19) exited non-zero on ‘SIP/1001-083c2a18’ in macro ‘dialout-trunk’
== Spawn extension (macro-dialout-trunk, s, 19) exited non-zero on ‘SIP/1001-083c2a18’
– Executing [h@macro-dialout-trunk:1] Macro(“SIP/1001-083c2a18”, “hangupcall|”) in new stack
– Executing [s@macro-hangupcall:1] GotoIf(“SIP/1001-083c2a18”, “1?skiprg”) in new stack
– Goto (macro-hangupcall,s,4)
– Executing [s@macro-hangupcall:4] GotoIf(“SIP/1001-083c2a18”, “1?skipblkvm”) in new stack
– Goto (macro-hangupcall,s,7)
– Executing [s@macro-hangupcall:7] GotoIf(“SIP/1001-083c2a18”, “1?theend”) in new stack
– Goto (macro-hangupcall,s,9)
– Executing [s@macro-hangupcall:9] Hangup(“SIP/1001-083c2a18”, “”) in new stack
== Spawn extension (macro-hangupcall, s, 9) exited non-zero on ‘SIP/1001-083c2a18’ in macro ‘hangupcall’
== Spawn extension (macro-hangupcall, s, 9) exited non-zero on ‘SIP/1001-083c2a18’
== End MixMonitor Recording SIP/1001-083c2a18

but the calldate in cdr databse is recorded as “2010-08-16 18:29:45” and disposition “NO ANSWER”

and here is the verbose that making call by manually key-in

– Executing [0016175669300@from-internal:1] Macro(“SIP/1001-083c2a18”, “user-callerid|SKIPTTL|”) in new stack
– Executing [s@macro-user-callerid:1] Set(“SIP/1001-083c2a18”, “AMPUSER=1001”) in new stack
– Executing [s@macro-user-callerid:2] GotoIf(“SIP/1001-083c2a18”, “0?report”) in new stack
– Executing [s@macro-user-callerid:3] ExecIf(“SIP/1001-083c2a18”, “1|Set|REALCALLERIDNUM=1001”) in new stack
– Executing [s@macro-user-callerid:4] Set(“SIP/1001-083c2a18”, “AMPUSER=1001”) in new stack
– Executing [s@macro-user-callerid:5] Set(“SIP/1001-083c2a18”, “AMPUSERCIDNAME=ANZ1001”) in new stack
– Executing [s@macro-user-callerid:6] GotoIf(“SIP/1001-083c2a18”, “0?report”) in new stack
– Executing [s@macro-user-callerid:7] Set(“SIP/1001-083c2a18”, “AMPUSERCID=1001”) in new stack
– Executing [s@macro-user-callerid:8] Set(“SIP/1001-083c2a18”, “CALLERID(all)=“ANZ1001” <1001>”) in new stack
– Executing [s@macro-user-callerid:9] ExecIf(“SIP/1001-083c2a18”, “0|Set|CHANNEL(language)=”) in new stack
– Executing [s@macro-user-callerid:10] GotoIf(“SIP/1001-083c2a18”, “1?continue”) in new stack
– Goto (macro-user-callerid,s,19)
– Executing [s@macro-user-callerid:19] NoOp(“SIP/1001-083c2a18”, “Using CallerID “ANZ1001” <1001>”) in new stack
– Executing [0016175669300@from-internal:2] Set(“SIP/1001-083c2a18”, “_NODEST=”) in new stack
– Executing [0016175669300@from-internal:3] Macro(“SIP/1001-083c2a18”, “record-enable|1001|OUT|”) in new stack
– Executing [s@macro-record-enable:1] GotoIf(“SIP/1001-083c2a18”, “1?check”) in new stack
– Goto (macro-record-enable,s,4)
– Executing [s@macro-record-enable:4] ExecIf(“SIP/1001-083c2a18”, “0|MacroExit|”) in new stack
– Executing [s@macro-record-enable:5] GotoIf(“SIP/1001-083c2a18”, “0?Group:OUT”) in new stack
– Goto (macro-record-enable,s,15)
– Executing [s@macro-record-enable:15] GotoIf(“SIP/1001-083c2a18”, “0?IN”) in new stack
– Executing [s@macro-record-enable:16] ExecIf(“SIP/1001-083c2a18”, “0|MacroExit|”) in new stack
– Executing [s@macro-record-enable:17] NoOp(“SIP/1001-083c2a18”, “Recording enable for 1001”) in new stack
– Executing [s@macro-record-enable:18] Set(“SIP/1001-083c2a18”, “CALLFILENAME=OUT1001-20100816-180827-1281956907.240”) in new stack
– Executing [s@macro-record-enable:19] Goto(“SIP/1001-083c2a18”, “record”) in new stack
– Goto (macro-record-enable,s,23)
– Executing [s@macro-record-enable:23] MixMonitor(“SIP/1001-083c2a18”, “OUT1001-20100816-180827-1281956907.240.wav||”) in new stack
– Executing [s@macro-record-enable:24] MacroExit(“SIP/1001-083c2a18”, “”) in new stack
== Begin MixMonitor Recording SIP/1001-083c2a18
– Executing [0016175669300@from-internal:4] Macro(“SIP/1001-083c2a18”, “dialout-trunk|2|0016175669300||”) in new stack
– Executing [s@macro-dialout-trunk:1] Set(“SIP/1001-083c2a18”, “DIAL_TRUNK=2”) in new stack
– Executing [s@macro-dialout-trunk:2] GosubIf(“SIP/1001-083c2a18”, “0?sub-pincheck|s|1”) in new stack
– Executing [s@macro-dialout-trunk:3] GotoIf(“SIP/1001-083c2a18”, “0?disabletrunk|1”) in new stack
– Executing [s@macro-dialout-trunk:4] Set(“SIP/1001-083c2a18”, “DIAL_NUMBER=0016175669300”) in new stack
– Executing [s@macro-dialout-trunk:5] Set(“SIP/1001-083c2a18”, “DIAL_TRUNK_OPTIONS=tr”) in new stack
– Executing [s@macro-dialout-trunk:6] Set(“SIP/1001-083c2a18”, “OUTBOUND_GROUP=OUT_2”) in new stack
– Executing [s@macro-dialout-trunk:7] GotoIf(“SIP/1001-083c2a18”, “1?nomax”) in new stack
– Goto (macro-dialout-trunk,s,9)
– Executing [s@macro-dialout-trunk:9] GotoIf(“SIP/1001-083c2a18”, “0?skipoutcid”) in new stack
– Executing [s@macro-dialout-trunk:10] Set(“SIP/1001-083c2a18”, “DIAL_TRUNK_OPTIONS=”) in new stack
– Executing [s@macro-dialout-trunk:11] Macro(“SIP/1001-083c2a18”, “outbound-callerid|2”) in new stack
– Executing [s@macro-outbound-callerid:1] ExecIf(“SIP/1001-083c2a18”, “0|SetCallerPres|”) in new stack
– Executing [s@macro-outbound-callerid:2] ExecIf(“SIP/1001-083c2a18”, “0|Set|REALCALLERIDNUM=1001”) in new stack
– Executing [s@macro-outbound-callerid:3] GotoIf(“SIP/1001-083c2a18”, “1?normcid”) in new stack
– Goto (macro-outbound-callerid,s,6)
– Executing [s@macro-outbound-callerid:6] Set(“SIP/1001-083c2a18”, “USEROUTCID=”) in new stack
– Executing [s@macro-outbound-callerid:7] Set(“SIP/1001-083c2a18”, “EMERGENCYCID=”) in new stack
– Executing [s@macro-outbound-callerid:8] Set(“SIP/1001-083c2a18”, “TRUNKOUTCID=0873066668”) in new stack
– Executing [s@macro-outbound-callerid:9] GotoIf(“SIP/1001-083c2a18”, “1?trunkcid”) in new stack
– Goto (macro-outbound-callerid,s,12)
– Executing [s@macro-outbound-callerid:12] ExecIf(“SIP/1001-083c2a18”, “1|Set|CALLERID(all)=0873066668”) in new stack
– Executing [s@macro-outbound-callerid:13] ExecIf(“SIP/1001-083c2a18”, “0|Set|CALLERID(all)=”) in new stack
– Executing [s@macro-outbound-callerid:14] ExecIf(“SIP/1001-083c2a18”, “0|Set|CALLERID(all)=”) in new stack
– Executing [s@macro-outbound-callerid:15] ExecIf(“SIP/1001-083c2a18”, “0|SetCallerPres|prohib_passed_screen”) in new stack
– Executing [s@macro-dialout-trunk:12] ExecIf(“SIP/1001-083c2a18”, “0|AGI|fixlocalprefix”) in new stack
– Executing [s@macro-dialout-trunk:13] Set(“SIP/1001-083c2a18”, “OUTNUM=0016175669300”) in new stack
– Executing [s@macro-dialout-trunk:14] Set(“SIP/1001-083c2a18”, “custom=SIP/fpt-ivoice”) in new stack
– Executing [s@macro-dialout-trunk:15] ExecIf(“SIP/1001-083c2a18”, “0|Set|DIAL_TRUNK_OPTIONS=M(setmusic^)”) in new stack
– Executing [s@macro-dialout-trunk:16] Macro(“SIP/1001-083c2a18”, “dialout-trunk-predial-hook|”) in new stack
– Executing [s@macro-dialout-trunk-predial-hook:1] MacroExit(“SIP/1001-083c2a18”, “”) in new stack
– Executing [s@macro-dialout-trunk:17] GotoIf(“SIP/1001-083c2a18”, “0?bypass|1”) in new stack
– Executing [s@macro-dialout-trunk:18] GotoIf(“SIP/1001-083c2a18”, “0?customtrunk”) in new stack
– Executing [s@macro-dialout-trunk:19] Dial(“SIP/1001-083c2a18”, “SIP/fpt-ivoice/0016175669300|300|”) in new stack
– Called fpt-ivoice/0016175669300
– SIP/fpt-ivoice-0830fba8 is making progress passing it to SIP/1001-083c2a18
– SIP/fpt-ivoice-0830fba8 is making progress passing it to SIP/1001-083c2a18
– SIP/fpt-ivoice-0830fba8 answered SIP/1001-083c2a18
== Spawn extension (macro-dialout-trunk, s, 19) exited non-zero on ‘SIP/1001-083c2a18’ in macro ‘dialout-trunk’
== Spawn extension (macro-dialout-trunk, s, 19) exited non-zero on ‘SIP/1001-083c2a18’
– Executing [h@macro-dialout-trunk:1] Macro(“SIP/1001-083c2a18”, “hangupcall|”) in new stack
– Executing [s@macro-hangupcall:1] GotoIf(“SIP/1001-083c2a18”, “1?skiprg”) in new stack
– Goto (macro-hangupcall,s,4)
– Executing [s@macro-hangupcall:4] GotoIf(“SIP/1001-083c2a18”, “1?skipblkvm”) in new stack
– Goto (macro-hangupcall,s,7)
– Executing [s@macro-hangupcall:7] GotoIf(“SIP/1001-083c2a18”, “1?theend”) in new stack
– Goto (macro-hangupcall,s,9)
– Executing [s@macro-hangupcall:9] Hangup(“SIP/1001-083c2a18”, “”) in new stack
== Spawn extension (macro-hangupcall, s, 9) exited non-zero on ‘SIP/1001-083c2a18’ in macro ‘hangupcall’
== Spawn extension (macro-hangupcall, s, 9) exited non-zero on ‘SIP/1001-083c2a18’
== End MixMonitor Recording SIP/1001-083c2a18

then the calldate is showing “2010-08-16 18:08:27” and disposition is “ANSWERED”

Thanks for your help