Guy Boehm
2005-Apr-26 23:58 UTC
[Asterisk-Users] call a peer over the asterisk manager with a php script
Hello, I want to call a peer over the Asterisk Manager with this php-script: <html> <body> <PRE> <? $socket = fsockopen("192.168.204.44","5038", $errno, $errstr, $timeout); fputs($socket, "Action: Login\r\n"); fputs($socket, "UserName: test\r\n"); fputs($socket, "Secret: test\r\n\r\n"); //fputs($socket, "Action: ListCommands\r\n\r\n"); fputs($socket, "Action: Originate\r\n"); fputs($socket, "Channel: 6159bfb47b9\r\n\r\n"); fputs($socket, "Exten: 1009\r\n\r\n"); fputs($socket, "Context: test\r\n\r\n"); fputs($socket, "Priority: 1\r\n\r\n"); fputs($socket, "Action: Logoff\r\n\r\n"); while (!feof($socket)) { $wrets .= fread($socket, 8192); } fclose($socket); echo <<<ASTERISKMANAGEREND ASTERISK MANAGER OUTPUT: $wrets ASTERISKMANAGEREND; ?> </pre> I got this resulat: ASTERISK MANAGER OUTPUT:Asterisk Call Manager/1.0Response: SuccessMessage: Authentication acceptedResponse: ErrorMessage: Invalid channelResponse: ErrorMessage: Missing action in requestResponse: ErrorMessage: Missing action in requestResponse: ErrorMessage: Missing action in requestResponse: GoodbyeMessage: Thanks for all the fish.I tried many diffrent SIP/Channels but nothing works THX --------------------------------- Gesendet von Yahoo! Mail - Jetzt mit 250MB kostenlosem Speicher -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20050427/69466c77/attachment.htm
Richard Lyman
2005-Apr-27 09:47 UTC
[Asterisk-Users] call a peer over the asterisk manager with a php script
Guy Boehm wrote:> fputs($socket, "Channel: 6159bfb47b9\r\n\r\n"); > >Response: Error >Message: Invalid channel > > > >the Channel: var needs to be in the form of type/dev/numbertocall like Channel: IAX2/user:pw@context/14085551212
Dana Olson
2005-Apr-27 12:56 UTC
[Asterisk-Users] call a peer over the asterisk manager with a php script
On 4/27/05, Guy Boehm <dendengens@yahoo.de> wrote:> Hello, > > I want to call a peer over the Asterisk Manager with this php-script: > > > <html> > <body> > <PRE> > <? > $socket = fsockopen("192.168.204.44","5038", $errno, $errstr, > $timeout); > fputs($socket, "Action: Login\r\n"); > fputs($socket, "UserName: test\r\n"); > fputs($socket, "Secret: test\r\n\r\n"); > //fputs($socket, "Action: ListCommands\r\n\r\n"); > > fputs($socket, "Action: Originate\r\n"); > fputs($socket, "Channel: 6159bfb47b9\r\n\r\n"); > fputs($socket, "Exten: 1009\r\n\r\n"); > fputs($socket, "Context: test\r\n\r\n"); > fputs($socket, "Priority: 1\r\n\r\n"); > > > fputs($socket, "Action: Logoff\r\n\r\n"); > while (!feof($socket)) { > $wrets .= fread($socket, 8192); > } > fclose($socket); > echo <<<ASTERISKMANAGEREND > ASTERISK MANAGER OUTPUT: > $wrets > ASTERISKMANAGEREND; > ?> > </pre> > > > > I got this resulat: > > ASTERISK MANAGER OUTPUT:Asterisk Call Manager/1.0 Response:> SuccessMessage: Authentication accepted Response: Error Message: Invalid> channelResponse: Error Message: Missing action in request Response:> ErrorMessage: Missing action in request Response: Error Message: Missing> action in requestResponse: Goodbye Message: Thanks for all the fish. I> tried many diffrent SIP/Channels but nothing works > > THXOn top of what Richard mentioned, you have too many \r\n in the Originate action parameters. Only the final one should have two sets, the others hould have only one. -- Dana
Guy Boehm
2005-Apr-29 00:07 UTC
[Asterisk-Users] call a peer over the asterisk manager with a php script
wau thank you it works!! but, first it says that e loop is detected, and secondary what must I do to hand over the new working channel to my x-lite to use it??? DENGENS Dana Olson <rickaster@gmail.com> wrote: On 4/27/05, Guy Boehm wrote:> Hello, > > I want to call a peer over the Asterisk Manager with this php-script: > > > > >> > $socket = fsockopen("192.168.204.44","5038", $errno, $errstr, > $timeout); > fputs($socket, "Action: Login\r\n"); > fputs($socket, "UserName: test\r\n"); > fputs($socket, "Secret: test\r\n\r\n"); > //fputs($socket, "Action: ListCommands\r\n\r\n"); > > fputs($socket, "Action: Originate\r\n"); > fputs($socket, "Channel: 6159bfb47b9\r\n\r\n"); > fputs($socket, "Exten: 1009\r\n\r\n"); > fputs($socket, "Context: test\r\n\r\n"); > fputs($socket, "Priority: 1\r\n\r\n"); > > > fputs($socket, "Action: Logoff\r\n\r\n"); > while (!feof($socket)) { > $wrets .= fread($socket, 8192); > } > fclose($socket); > echo <<> ASTERISK MANAGER OUTPUT: > $wrets > ASTERISKMANAGEREND; > ?> >> > > > I got this resulat: > > ASTERISK MANAGER OUTPUT:Asterisk Call Manager/1.0 Response:> SuccessMessage: Authentication accepted Response: Error Message: Invalid> channelResponse: Error Message: Missing action in request Response:> ErrorMessage: Missing action in request Response: Error Message: Missing> action in requestResponse: Goodbye Message: Thanks for all the fish. I> tried many diffrent SIP/Channels but nothing works > > THXOn top of what Richard mentioned, you have too many \r\n in the Originate action parameters. Only the final one should have two sets, the others hould have only one. -- Dana _______________________________________________ Asterisk-Users mailing list Asterisk-Users@lists.digium.com http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users --------------------------------- Gesendet von Yahoo! Mail - Jetzt mit 250MB kostenlosem Speicher -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20050429/c51e0267/attachment.htm
Guy Boehm
2005-Apr-29 00:08 UTC
[Asterisk-Users] call a peer over the asterisk manager with a php script
wau thank you it works!! but, first it says that e loop is detected, and secondary what must I do to hand over the new working channel to my x-lite to use it??? DENGENS Richard Lyman <pchammer@dynx.net> wrote: Guy Boehm wrote:> fputs($socket, "Channel: 6159bfb47b9\r\n\r\n"); > >Response: Error >Message: Invalid channel > > > >the Channel: var needs to be in the form of type/dev/numbertocall like Channel: IAX2/user:pw@context/14085551212 _______________________________________________ Asterisk-Users mailing list Asterisk-Users@lists.digium.com http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users --------------------------------- Gesendet von Yahoo! Mail - Jetzt mit 250MB kostenlosem Speicher -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20050429/80c1c1eb/attachment.htm