How To Put Click to Call On Your Website
Reply from phonesystem254 on Nov 07, 2009 - 05:38 AM
According to my understanding of AMI mesages in call.php, the exten is a number of person who put his number to text box. so how can we create it exten on runtime in extensions.conf?
Reply from phonesystem254 on Nov 07, 2009 - 06:30 AM
following is my call.php, its a testing file in which I just want to test the AMI connection between script and astreisk.
--------------------------call.php------------------------
<html>
<body>
<?php
$User_str = "manager";
$Secret_str = "123456";
$fp = fsockopen("192.168.5.64", 5038, $errno, $errstr, 300000);
if (!$fp) {
echo "not open";
} else {
echo "open";
fputs($fp, "Action: login\r\n");
fputs($fp, "Username: manager\r\n");
fputs($fp, "Secret: itsec123\r\n");
fputs($fp, "Action: originate\r\n");
fputs($fp, "Channel: SIP/2100\r\n");
fputs($fp, "WaitTime: 300000\r\n");
fputs($fp, "CallerId: 2200\r\n");
fputs($fp, "Exten: 2200\r\n");
fputs($fp, "Context: default\r\n");
fputs($fp, "Async: true\r\n");
fputs($fp, "Priority: 1\r\n\r\n");
// fputs($fp, "Action: Logoff\r\n\r\n");
fputs($fp, "\r\n");
fputs($fp, "\r\n");
sleep(2);
}
fclose($fp);
?>
</body>
</html>
-----------------------Asterisk Console------------------
what I found on asterisk console when I run my script:
== Manager 'manager' logged on from 192.168.5.57
== Manager 'manager' logged off from 192.168.5.57
------------------------------------------------------
Also mmy both soft phones areregistered with extensions 2100 and 2200.
-----------------extensions.conf--------------------
Here is my extensions.conf default context:
[default]
exten => 2200,1,Answer()
exten => 2200,1,Dial(SIP/2100)
Reply from phonesystem254 on Nov 07, 2009 - 07:39 AM
Sorry for distrubing
Here is my call.php:
<html>
<body>
<?php
$User_str = "manager";
$Secret_str = "123456";
$WaitTime = "30";
$scrname="2500";
$fp = fsockopen("192.168.5.64", 5038, $errno, $errstr, 300000);
if (!$fp) {
echo "not open";
} else {
echo "open";
sleep(1);
fputs($fp, "Action: login\r\n");
fputs($fp, "Username: manager\r\n");
fputs($fp, "Secret: itsec123\r\n\r\n");
fputs($fp, "Events: off\r\n\r\n");
fputs($fp, "Action: originate\r\n");
fputs($fp, "Channel: SIP/2100\r\n");
fputs($fp, "WaitTime: 30\r\n");
fputs($fp, "CallerId: $scrname\r\n");
fputs($fp, "Exten: $scrname\r\n");
fputs($fp, "Context: default\r\n");
fputs($fp, "Async: true\r\n");
fputs($fp, "Priority: 1\r\n\r\n");
fputs($fp, "Action: Logoff\r\n\r\n");
sleep(2);
}
fclose($fp);
?>
</body>
</html>
and here is my extensions.conf [default] context:
exten => 2500,1,Answer()
exten => 2500,2, Dial(SIP/2500)
----------------------------------------------------
I am able to connect my two soft phones with this configuration, but I am not understanding, when we have generlized $scrname like we dont know whoes calling us, so how can we build its extension into extensions. conf? Kindly help me out?
Also Is my configuration of extensions.conf is a right way?
Reply from phonesystem254 on Dec 24, 2009 - 08:05 AM
what happened? no one have answer of my question?
| Forum Rules and Guidelines |
About VoIP User |
Privacy Policy
|
All logos and trademarks in this site are property of their respective owner. Comments and posts are property of the poster, all the rest (c) 2003-2008 VoIP User Limited.
VoIP User Limited is incorporated in England and Wales under Company Number 6694577.
No part of this site may be reproduced without our prior consent.
|