Postmaster - Allomundo.com
2006-May-23 05:17 UTC
[Asterisk-Users] Outband call from php script
Hello, I am trying to make the following... Can someone tell me if it is possible? Is someone willing to do it from an asterisk@home box? 1. I send an http request to asterisk@home box. Ex: http://asterisk@home/call.php?phone=0033102030405&code=12345 2. Application will call phone number 0033102030405 (using a sip provider) 3. Application will play a pre-recorded voice prompt 4. Application will invite the user to enter a number password 5. If password match code of the URL (12345 in this exemple), application send an http request back to me. Ex : http://mywebserver/response.php?phone=0033102030405&verif=OK or 5. If password does not match code of the URL, ask user to retry (up to 3 time). If conversation is over 90 secs, hang-up and send an http request back to me. Ex : http://mywebserver/response.php?phone=0033102030405&verif=not_OK Thx. G.
In http://nerdvittles.com/index.php?p=63 I've found a simple script
for doing this.
file callme.php
<?php
// (c) Copyright Ward Mundy, 2005. All rights reserved.
// This script will only work with Asterisk@Home ver. 1.3 or higher
// Syntax: http://asterisk.dyndns.org/callme.php?number=sip/bv/4045551212
// where asterisk.dyndns.org is the fully-qualified domain name of
your Asterisk server
// and 4045551212 is the number to be called immediately to provide dialtone
// This script will not work without adding [callout] context to
extensions_custom.conf. See below.
// Change 24681234 below to a very secure PIN number that the user
will be prompted for when call is made.
// [callout]
// exten => s,1,Authenticate(24681234)
// exten => s,2,DISA(no-password|from-internal)
// For additional documentation, visit Nerd Vittles blog at
// http://mundy.org/blog/index.php?p=63
// No changes should be made below this line
// For BroadVoice, dial strings should look like this: SIP/bv/14045551212
// To call a local extension with SIP, use the syntax: SIP/200 where
200 is the extension number
// MAKE ALL EXISTING ACCOUNTS SECURE BEFORE OPENING ASTERISK WEB
SERVER TO BIG, BAD INTERNET!!!
$number=strtolower($_REQUEST['number']);
$pos=strpos ($number,"local");
if ($number == null) :
exit() ;
endif ;
if ($pos===false) :
$errno=0 ;
$errstr=0 ;
$fp = fsockopen ("localhost", 5038, &$errno, &$errstr, 20);
if (!$fp) {
echo "$errstr ($errno)<br>\n";
} else {
fputs ($fp, "Action: login\r\n");
fputs ($fp, "Username: phpagi\r\n");
fputs ($fp, "Secret: phpagi\r\n");
fputs ($fp, "Events: off\r\n\r\n");
sleep(1) ;
fputs ($fp, "Action: Originate\r\n");
fputs ($fp, "Channel: $number\r\n");
fputs ($fp, "Context: callout\r\n");
fputs ($fp, "Extension: s\r\n");
fputs ($fp, "Priority: 1\r\n\r\n");
sleep(2) ;
fclose ($fp);
}
echo "Extension $number should be ringing now." ;
else :
exit() ;
endif ;
?>
Add this to extensions.conf (or extensions_custom.conf if you are
using asteriskathome)
[dialtone]
exten => s,1,DISA(1234,from-internal)
exten => s,2,Hangup
where "1234" is a pin that must be entered
--
Alejandro Vargas
Friends, I have message error in module Extensions in Asterisk : Fatal error: Maximum execution time of 30 seconds exceeded in /var/www/html/admin/common/php-asmanager.php on line 169 Do you know this message error ? Thank?s Gustavo Queiroz - Rio de Janeiro - Brasil -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20060523/3d45eb7f/attachment.htm