Created
February 2, 2021 03:45
-
-
Save ambiorixg12/554039e850e318dc71d9c7619e0f89f9 to your computer and use it in GitHub Desktop.
Asterisk TEST
This file contains hidden or 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
| [outbound] | |
| exten=>_xxx,1,Noop() | |
| same=>n,dial(SIP/${EXTEN}) | |
| same=>n,hangup() | |
| [outbound_2] | |
| exten=>_xxx,1,Noop() | |
| same=>n,Set(CALLERID(num)=${cid}) | |
| same=>n,dial(SIP/${EXTEN},45,A(${sfc})) | |
| same => n,GotoIf($["${DIALSTATUS}" = "BUSY"]?busy:unavail) | |
| same => n(unavail),Playback(im-sorry) | |
| same => n,Hangup() | |
| same => n(busy),Playback(im-sorry) | |
| same => n,Hangup() | |
| ;;;;;;;;;;;;;;;;;;;;;;end of Asterisk code ;;;;;;;;;;;;;;;;; | |
| ::::::php code:::::: | |
| <?php | |
| $timeout=10; | |
| $host="127.0.0.1"; | |
| $port=5038; | |
| $src = preg_replace('/\s+/', '', $argv[1]); | |
| $dst = preg_replace('/\s+/', '', $argv[2]); | |
| $cid = preg_replace('/\s+/', '', $argv[3]); | |
| $calle_cid="Callee<800>"; | |
| $context1="outbound"; | |
| $context2="outbound_2"; | |
| $sound_file_callee="demo-thanks"; | |
| $socket = fsockopen("$host",$port,$errno, $errstr, $timeout); | |
| fputs($socket, "Action: Login\r\n"); | |
| fputs($socket, "UserName: admin\r\n"); // | |
| fputs($socket, "Secret: 6a167d\r\n\r\n"); // // | |
| $wrets=fgets($socket,128); | |
| fputs($socket, "Action: Originate\r\n" ); | |
| fputs($socket, "Channel: Local/$src@$context1/n\r\n" ); | |
| fputs($socket, "Exten: $dst\r\n" ); | |
| fputs($socket, "Context: $context2\r\n" ); | |
| fputs($socket, "Priority: 1\r\n" ); | |
| fputs($socket, "CallerID: $calle_cid\r\n" ); | |
| fputs($socket, "Variable: __var1=$email\r\n" ); | |
| fputs($socket, "Variable: __trunk=$trunk\r\n" ); | |
| fputs($socket, "Variable: __dest=$dest\r\n" ); | |
| fputs($socket, "Variable: __cid=$cid\r\n" ); | |
| fputs($socket, "Variable: __sfc=$sound_file_callee\r\n" ); | |
| fputs($socket, "Async: yes\r\n\r\n" ); | |
| fputs($socket, "Action: Logoff\r\n\r\n"); | |
| sleep (1); | |
| $wrets=fgets($socket,128); | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment