Hello, <br><br>I need to be able to send a DTMF to an existing channel remotely. So I made a php script to do such with the Manager command PlayDTMF. I need it for example to start a transfer.<br><br>isb177*CLI> features show<br>
Builtin Feature Default Current<br>
--------------- ------- -------<br>
Pickup *8 *8<br>
Blind Transfer # #8<br>
Attended Transfer *2<br>
One Touch Monitor *1<br>
Disconnect Call * **<br>
Park Call<br>
One Touch MixMonitor<br>
<br>
Dynamic Feature Default Current<br>
--------------- ------- -------<br>
(none)<br>
<br>
Call parking<br>
------------<br>
Parking extension : 70<br>
Parking context : parkedcalls<br>
Parked call extensions: 71-78<br>
<br><br>My script is:<br><br>#!/usr/bin/php -q<br>
<?php<br>
error_reporting (E_ALL);<br>
set_time_limit(60);<br>
ob_implicit_flush(false);<br>
<br>
$ip_asterisk = "127.0.0.1";<br>
$user_asterisk = "admin";<br>
$pass_asterisk = "forward";<br>
$canal = "SIP/1000-0a292360"; //hardcodeado<br>
<br>
$oSocket = fsockopen($ip_asterisk, 5038, $errnum, $errdesc) or die("Connection to host failed");<br>
fputs($oSocket, "Action: login\r\n");<br>
fputs($oSocket, "Username: $user_asterisk\r\n");<br>
fputs($oSocket, "Secret: $pass_asterisk\r\n\r\n");<br>
fputs($oSocket, "Action: PlayDTMF\r\n");<br>
fputs($oSocket, "Channel: $canal\r\n");<br>
fputs($oSocket, "Digit: #\r\n\r\n");<br>
usleep(500000);<br>
fputs($oSocket, "Action: PlayDTMF\r\n");<br>
fputs($oSocket, "Channel: $canal\r\n");<br>
fputs($oSocket, "Digit: 8\r\n\r\n");<br>
usleep(500000);<br>
fputs($oSocket, "Action: Logoff\r\n\r\n");<br>
<br>
// Carga toda la respuesta recibida en un string<br>
$loaded = "";<br>
while (!feof($oSocket)){<br>
$buffer = fgets($oSocket, 4096);<br>
$loaded .= $buffer;<br>
}<br>
<br>
$vec = explode("\n", $loaded);<br>
$len = count($vec);<br>
print_r($vec);<br>?><br><br><br>The script output is:<br><br>Array<br>
(<br>
[0] => Asterisk Call Manager/1.1<br>
[1] => Response: Success<br>
[2] => Message: Authentication accepted<br>
[3] =><br>
[4] => Response: Success<br>
[5] => Message: DTMF successfully queued<br>
[6] =><br>
[7] => Response: Success<br>
[8] => Message: DTMF successfully queued<br>
[9] =><br>
[10] => Response: Goodbye<br>
[11] => Message: Thanks for all the fish.<br>
[12] =><br>
[13] =><br>
)<br><br><br>When I run the script I can hear the two digit (only the audio) but nothing happens, the Transfer menu doesnt start. The Cli shows:<br><br><br>
[Oct 2 11:14:46] DEBUG[30054]: manager.c:2776 process_message: Manager received command 'login'<br>
== Manager 'admin' logged on from 127.0.0.1<br>
[Oct 2 11:14:46] DEBUG[30054]: manager.c:2776 process_message: Manager received command 'PlayDTMF'<br>
[Oct 2 11:14:46] DEBUG[30054]: channel.c:2055 ast_waitfor_nandfds:
Thread -1216881776 Blocking 'SIP/1000-0a292360', already blocked by
thread -1217414256 in procedure ast_waitfor_nandfds<br>
[Oct 2 11:14:47] DEBUG[29533]: channel.c:3341 ast_write: Deadlock avoided for write to channel 'SIP/1000-0a292360'<br>
[Oct 2 11:14:47] DEBUG[30054]: manager.c:2776 process_message: Manager received command 'PlayDTMF'<br>
[Oct 2 11:14:47] DEBUG[30054]: channel.c:2055 ast_waitfor_nandfds:
Thread -1216881776 Blocking 'SIP/1000-0a292360', already blocked by
thread -1217414256 in procedure ast_waitfor_nandfds<br>
[Oct 2 11:14:47] DEBUG[29533]: channel.c:3341 ast_write: Deadlock avoided for write to channel 'SIP/1000-0a292360'<br>
[Oct 2 11:14:47] DEBUG[30054]: manager.c:2776 process_message: Manager received command 'Logoff'<br>
== Manager 'admin' logged off from 127.0.0.1<br><br><br>BUT, if I press #8 in the softphone, I can hear the two digit and inmediately the Transfer menu begins playing 'pbx-transfer.gsm'. And the Cli output in this case is:<br>
<br>[Oct 2 11:09:17] DEBUG[29533]: rtp.c:1148 ast_rtcp_read: Got RTCP report of 60 bytes<br>[Oct 2 11:09:20] DEBUG[29533]: rtp.c:958 process_rfc2833: - RTP 2833 Event: 0000000b (len = 4)<br>[Oct 2 11:09:20] DEBUG[29533]: rtp.c:806 send_dtmf: Sending dtmf: 35 (#), at 192.168.0.148<br>
[Oct 2 11:09:20] DTMF[29533]: channel.c:2840 __ast_read: DTMF begin '#' received on SIP/1000-0a292360<br>[Oct 2 11:09:20] DTMF[29533]: channel.c:2850 __ast_read: DTMF begin passthrough '#' on SIP/1000-0a292360<br>
[Oct 2 11:09:20] DEBUG[29533]: channel.c:4806 ast_generic_bridge: Got DTMF begin on channel (SIP/1000-0a292360)<br>[Oct 2 11:09:20] DEBUG[29533]: channel.c:5150 ast_channel_bridge: Bridge stops bridging channels SIP/1000-0a292360 and SIP/1001-0a026408<br>
[Oct 2 11:09:20] DEBUG[29533]: rtp.c:958 process_rfc2833: - RTP 2833 Event: 0000000b (len = 4)<br>[Oct 2 11:09:20] DEBUG[29533]: rtp.c:958 process_rfc2833: - RTP 2833 Event: 0000000b (len = 4)<br>[Oct 2 11:09:20] DEBUG[29533]: rtp.c:958 process_rfc2833: - RTP 2833 Event: 0000000b (len = 4)<br>
[Oct 2 11:09:20] DEBUG[29533]: rtp.c:958 process_rfc2833: - RTP 2833 Event: 0000000b (len = 4)<br>[Oct 2 11:09:20] DEBUG[29533]: rtp.c:806 send_dtmf: Sending dtmf: 35 (#), at 192.168.0.148<br>[Oct 2 11:09:20] DTMF[29533]: channel.c:2768 __ast_read: DTMF end '#' received on SIP/1000-0a292360, duration 80 ms<br>
[Oct 2 11:09:20] DTMF[29533]: channel.c:2808 __ast_read: DTMF end accepted with begin '#' on SIP/1000-0a292360<br>[Oct 2 11:09:20] DTMF[29533]: channel.c:2824 __ast_read: DTMF end passthrough '#' on SIP/1000-0a292360<br>
[Oct 2 11:09:20] DEBUG[29533]: channel.c:4806 ast_generic_bridge: Got DTMF end on channel (SIP/1000-0a292360)<br>[Oct 2 11:09:20] DEBUG[29533]: channel.c:5150 ast_channel_bridge: Bridge stops bridging channels SIP/1000-0a292360 and SIP/1001-0a026408<br>
[Oct 2 11:09:20] DEBUG[29533]: features.c:1836 ast_feature_interpret: Feature interpret: chan=SIP/1000-0a292360, peer=SIP/1001-0a026408, code=#, sense=1, features=2, dynamic=#<br>[Oct 2 11:09:20] DEBUG[29533]: features.c:2496 ast_bridge_call: Set time limit to 2000<br>
[Oct 2 11:09:20] DEBUG[29533]: rtp.c:958 process_rfc2833: - RTP 2833 Event: 0000000b (len = 4)<br>[Oct 2 11:09:20] DEBUG[29533]: rtp.c:958 process_rfc2833: - RTP 2833 Event: 0000000b (len = 4)<br>[Oct 2 11:09:21] DEBUG[29533]: rtp.c:958 process_rfc2833: - RTP 2833 Event: 00000008 (len = 4)<br>
[Oct 2 11:09:21] DEBUG[29533]: rtp.c:806 send_dtmf: Sending dtmf: 56 (8), at 192.168.0.148<br>[Oct 2 11:09:21] DTMF[29533]: channel.c:2840 __ast_read: DTMF begin '8' received on SIP/1000-0a292360<br>[Oct 2 11:09:21] DTMF[29533]: channel.c:2850 __ast_read: DTMF begin passthrough '8' on SIP/1000-0a292360<br>
[Oct 2 11:09:21] DEBUG[29533]: channel.c:4806 ast_generic_bridge: Got DTMF begin on channel (SIP/1000-0a292360)<br>[Oct 2 11:09:21] DEBUG[29533]: channel.c:5150 ast_channel_bridge: Bridge stops bridging channels SIP/1000-0a292360 and SIP/1001-0a026408<br>
[Oct 2 11:09:21] DEBUG[29533]: rtp.c:958 process_rfc2833: - RTP 2833 Event: 00000008 (len = 4)<br>[Oct 2 11:09:21] DEBUG[29533]: rtp.c:958 process_rfc2833: - RTP 2833 Event: 00000008 (len = 4)<br>[Oct 2 11:09:21] DEBUG[29533]: rtp.c:958 process_rfc2833: - RTP 2833 Event: 00000008 (len = 4)<br>
[Oct 2 11:09:21] DEBUG[29533]: rtp.c:958 process_rfc2833: - RTP 2833 Event: 00000008 (len = 4)<br>[Oct 2 11:09:21] DEBUG[29533]: rtp.c:958 process_rfc2833: - RTP 2833 Event: 00000008 (len = 4)<br>[Oct 2 11:09:21] DEBUG[29533]: rtp.c:958 process_rfc2833: - RTP 2833 Event: 00000008 (len = 4)<br>
[Oct 2 11:09:21] DEBUG[29533]: rtp.c:806 send_dtmf: Sending dtmf: 56 (8), at 192.168.0.148<br>[Oct 2 11:09:21] DTMF[29533]: channel.c:2768 __ast_read: DTMF end '8' received on SIP/1000-0a292360, duration 120 ms<br>
[Oct 2 11:09:21] DTMF[29533]: channel.c:2808 __ast_read: DTMF end accepted with begin '8' on SIP/1000-0a292360<br>[Oct 2 11:09:21] DTMF[29533]: channel.c:2824 __ast_read: DTMF end passthrough '8' on SIP/1000-0a292360<br>
[Oct 2 11:09:21] DEBUG[29533]: channel.c:4806 ast_generic_bridge: Got DTMF end on channel (SIP/1000-0a292360)<br>[Oct 2 11:09:21] DEBUG[29533]: channel.c:5150 ast_channel_bridge: Bridge stops bridging channels SIP/1000-0a292360 and SIP/1001-0a026408<br>
[Oct 2 11:09:21] DEBUG[29533]: features.c:1836 ast_feature_interpret: Feature interpret: chan=SIP/1000-0a292360, peer=SIP/1001-0a026408, code=#8, sense=1, features=2, dynamic=#<br>[Oct 2 11:09:21] DEBUG[29533]: features.c:1732 feature_interpret_helper: Feature detected: fname=Blind Transfer sname=blindxfer exten=#8<br>
-- Music class default requested but no musiconhold loaded.<br>[Oct 2 11:09:21] DEBUG[29533]: channel.c:3616 set_format: Set channel SIP/1000-0a292360 to write format gsm<br>[Oct 2 11:09:21] DEBUG[29533]: rtp.c:3099 ast_rtp_raw_write: Difference is 1952, ms is 264<br>
[Oct 2 11:09:21] DEBUG[29533]: channel.c:2362 ast_settimeout: Scheduling timer at 160 sample intervals<br> -- <SIP/1000-0a292360> Playing 'pbx-transfer.gsm' (language 'en')<br>[Oct 2 11:09:21] DEBUG[29533]: rtp.c:958 process_rfc2833: - RTP 2833 Event: 00000008 (len = 4)<br>
[Oct 2 11:09:21] DEBUG[29533]: rtp.c:958 process_rfc2833: - RTP 2833 Event: 00000008 (len = 4)<br>[Oct 2 11:09:21] DEBUG[16129]: rtp.c:1148 ast_rtcp_read: Got RTCP report of 60 bytes<br>[Oct 2 11:09:22] DEBUG[29533]: channel.c:2362 ast_settimeout: Scheduling timer at 0 sample intervals<br>
[Oct 2 11:09:22] DEBUG[29533]: channel.c:2362 ast_settimeout: Scheduling timer at 0 sample intervals<br>[Oct 2 11:09:22] DEBUG[29533]: channel.c:3616 set_format: Set channel SIP/1000-0a292360 to write format ulaw<br>[Oct 2 11:09:22] DEBUG[29533]: channel.c:3616 set_format: Set channel SIP/1000-0a292360 to write format slin<br>
[Oct 2 11:09:22] DEBUG[29533]: channel.c:2362 ast_settimeout: Scheduling timer at 160 sample intervals<br>[Oct 2 11:09:22] DEBUG[29533]: channel.c:3017 ast_internal_timing_enabled: Internal timing is disabled (option_internal_timing=0 chan->timingfd=32)<br>
[Oct 2 11:09:22] DEBUG[29533]: channel.c:2474 ast_read_generator_actions: Generator got voice, switching to phase locked mode<br>[Oct 2 11:09:22] DEBUG[29533]: channel.c:2362 ast_settimeout: Scheduling timer at 0 sample intervals<br>
<br><br>In case, my manager.conf is:<br><br>[general]<br>enabled = yes<br>port = 5038<br>bindaddr = 0.0.0.0<br>webenabled = yes<br>httptimeout = 3600<br><br>[admin]<br>secret = forward<br>deny=<a href="http://0.0.0.0/0.0.0.0">0.0.0.0/0.0.0.0</a><br>
permit=<a href="http://127.0.0.1/255.255.254.0">127.0.0.1/255.255.254.0</a><br>permit=<a href="http://192.168.0.0/255.255.0.0">192.168.0.0/255.255.0.0</a><br>read = system,call,log,verbose,agent,user,config,dtmf,reporting,cdr,dialplan,all<br>
write = system,call,agent,user,config,command,reporting,originate,all<br><br><br>My Asterisk version is 1.6.0.15, but I`ve tried it in 1.6.0.6 and 1.6.1.6 too and the same happens.<br>I dont know what I am missing...<br>Please help me.<br>
<br>Thank you very much.<br>