Created
September 23, 2016 06:42
-
-
Save kevin39/1452a83d9e47e1cd7dba5573ea653602 to your computer and use it in GitHub Desktop.
Asterisk Click2Call using PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$from = $_GET[from]; | |
$to = $_GET[to]; | |
$fromext = $_GET[fromext]; | |
$socket = fsockopen("localhost","5038", $errno, $errstr, $timeout); | |
fputs($socket, "Action: Login\r\n"); | |
fputs($socket, "UserName: USERNAME\r\n"); | |
fputs($socket, "Secret: PASSWORD\r\n\r\n"); | |
$wrets=fgets($socket,128); | |
fputs($socket, "Action: Originate\r\n" ); | |
fputs($socket, "Channel: SIP/$from\r\n" ); | |
fputs($socket, "Exten: $to\r\n" ); | |
fputs($socket, "Callerid: $fromext\r\n" ); | |
fputs($socket, "Context: default\r\n" ); | |
fputs($socket, "Priority: 1\r\n" ); | |
fputs($socket, "Async: yes\r\n\r\n" ); | |
$wrets=fgets($socket,128); | |
sleep(3); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment