Originate call Problems

All installation and configuration problems and questions

Moderators: gerski, enjay, williamconley, Op3r, Staydog, gardo, mflorell, MJCoate, mcargile, Kumba, Michael_N

Originate call Problems

Postby greg » Tue Dec 01, 2009 1:13 pm

How to define a username and password on:

/etc/asterisk/manager.conf

to originate a call from a php webform
this is the code i'm using on php form, but I got the error not autenticated

##### CODE ###
#specify the username you want to login with (these users are defined in /etc/asterisk/manager.conf)#this user is the default AAH AMP user; you shouldn't need to change, if you're using AAH.$strUser = "admin";#specify the password for the above user
$strSecret = "1101";
$strUser = "1101";
//"amp111";
#specify the channel (extension) you want to receive the call requests with
#e.g. SIP/XXX, IAX2/XXXX, ZAP/XXXX, etc
$strChannel = "SIP/1101";

#specify the context to make the outgoing call from. By default, AAH uses from-internal
#Using from-internal will make your outgoing dialing rules apply
$strContext = "vicidial-auto";

#specify the amount of time you want to try calling the specified channel before hangin up
$strWaitTime = "15";

#specify the priority you wish to place on making this call
$strPriority = "1";

#specify the maximum amount of retries
$strMaxRetry = "3";

$number=strtolower($_REQUEST['number']);
$pos=strpos ($number,"local");
if ($number == null) :
exit() ;
endif ;
if ($pos===false) :
$errno=0 ;
$errstr=0 ;
$strCallerId = "<$number>";
$oSocket = fsockopen ("localhost", 5038, &$errno, &$errstr, 20);
if (!$oSocket) {
echo "$errstr ($errno)<br>\n";
} else {
fputs($oSocket, "Action: login\r\n");
fputs($oSocket, "Events: off\r\n");
fputs($oSocket, "Username: $strUser\r\n");
fputs($oSocket, "Secret: $strSecret\r\n");
fputs($oSocket, "Action: originate\r\n");
fputs($oSocket, "Channel: $strChannel\r\n");
fputs($oSocket, "WaitTime: $strWaitTime\r\n");
fputs($oSocket, "CallerId: $strCallerId\r\n");
fputs($oSocket, "Exten: $number\r\n");
fputs($oSocket, "Context: $strContext\r\n");
fputs($oSocket, "Priority: $strPriority\r\n");
fputs($oSocket, "Action: Logoff\r\n\r\n");
fclose($oSocket);
}
echo "Extension $strChannel should be calling $number." ;
else :
exit() ;
endif ;
?>
greg
 
Posts: 6
Joined: Tue Dec 01, 2009 1:01 pm

Postby Michael_N » Tue Dec 01, 2009 1:30 pm

have you looked at non_agent_api.txt ?

located in docs/
Michael_N
 
Posts: 687
Joined: Wed Jul 05, 2006 3:13 pm
Location: sweden

i'll take a look at it

Postby greg » Tue Dec 01, 2009 1:44 pm

thanks
greg
 
Posts: 6
Joined: Tue Dec 01, 2009 1:01 pm


Return to Support

Who is online

Users browsing this forum: Google [Bot] and 58 guests