Asterisk+PHPʵ�ּ��ҳ��й���
���±�ţ�1256846236
�����ڣ�2011-10-16 23:12:01
=====================
Asterisk+PHPʵ�ּ��ҳ��й���
Asterisk֧���Զ����spool�����call�ļ������Զ���У������µ�call�ļ�
����Asterisk����ӵ��ļ��У�ͨ����/var/spool/asterisk/outgoing/ ʱ��As
terisk���Զ�����call�ļ������ݷ����У�
Call�ļ�����ϸ�÷������Ķ���һƪ����
http://www.voip-info.org/wiki/view/Asterisk+auto-dial+out
��Ҫʵ��web�ز����ܣ���ֻ��Ҫ����м���
Channel: ����һ�м�����ʹ�õ�ͨ����
Extension: ����һ���Dz���ķֻ��ţ���Ӧextensions.conf����IJ��żƻ���
ʵ������Ŀǰ��һ��������VPS�����Asterisk�������û�а�װ���������
����SIP��·��һ�google voice��·
�����ͨ�����ã�
SIP/fpl_edm/ ����һ���freephoneline.ca�ṩ������ڼ��ô�Edmonton����
�غ�
SIP/nonoh/ ����nonoh��SIP�˻������Բ���ʳ�;
Gtalk/gmail/ ����google voice�˻��������ṩһ�������san francisco����
�غ�
���żƻ����ã�
��������1��ͷʱ��ʹ��freephoneline��·������ô����
��������01��ͷʱ��ʹ��google voice��·�����������
��������00��ͷʱ��ʹ��nonoh����������ҵĹ��ʳ�;
�������������ֿ�ͷʱ�������Ӧ��SIP���߷ֻ�
������һ��PHPԴ�룬������get��ʽ����ı�
http://server/call.php?from=����&to=�����
��к����뱻�к������һ�µĹ���û���κ�ǰΪ���طֻ�����1��ͷΪ
���ô���룬��+��ͷΪ���ʳ�;������������룬���Զ���google voice��
��
<?php
$filename="/var/spool/asterisk/outgoing/web.call"; //call�ļ�λ��
$from=$_GET["from"];
$to=$_GET["to"];
echo "Dial Start \n";
if (strpos($from,"1") == 0 )
$from = "Channel: SIP/fpl_edm/".$from; //���ô����ͨ��fpl_edm��
elseif (strpos($from,"+1") === 0)
$from = "Channel: Gtalk/gmail/" . $from."@voice.google.com" ; //���
������google voice��
elseif (strpos($from,"+") === 0)
$from = "Channel: SIP/nonoh/" . $from; //���������nonoh��
else
$from = "Channel: SIP/". $from ; //δ��ǰ��Ϊ���ߣ�ֱ�Ӳ���SIP�ֻ�
if (strpos($to,"+1") === 0)
$to = str_replace("+","0",$to) ; //ת�����������+1תΪ��Ӧextensions
conf��01
elseif (strpos($to,"+") === 0)
$to = str_replace("+","00",$to) ; //ת�����ʺ�����+תΪ��Ӧextensions
conf��00
$to = "Extension:".$to; //���Extension:�ִ�
$word = $from."\n".$to."\n"; //��������call�ļ�����ı�
echo $word; //����ı��������ڳ���
$fh = fopen($filename, "w") or exit("Unable to open file!");
echo fwrite($fh, $word);
fclose($fh); //д�벢�ر��ļ�
?>
���˵�
���й�+8613987654321������+14534567890
http://server/call.php?from=+8613987654321&to=+14534567890
���������web.call�ļ�
Channel: SIP/nonoh/+8613987654321
Extension: 014534567890