Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
click to call using PHP
Old 09-22-2008, 02:51 PM click to call using PHP
Novice Talker

Posts: 8
Name: Denny Zebrowski
Location: Atlanta
Trades: 0
Ok guys...I have a php script that allows a customer to click a link, put there phonenumber in and call me... I would like to modify this script so it does not call me it calls them, and plays a recorded message. here is the sample script

PHP Code:
#specify the name/ip address of your asterisk box
#if your are hosting this page on your asterisk box, then you can use
#127.0.0.1 as the host IP.  Otherwise, you will need to edit the following
#line in manager.conf, under the Admin user section:
#permit=127.0.0.1/255.255.255.0
#change to:
#permit=127.0.0.1/255.255.255.0,xxx.xxx.xxx.xxx ;(the ip address of the server this page is running on)
$strHost "222.222.11.21";   ; this is the IP of the asterisk server
#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 "USER"user name on the Asterisk server
#specify the password for the above user
$strSecret "password"password for user on asterisk server
#specify the channel (extension) you want to receive the call requests with
#e.g. SIP/XXX, IAX2/XXXX, ZAP/XXXX, etc
$strChannel "SIP/15554445555@voipinvite"this is the telephone number the asterisk server will call.  I would like to replace this number with the phone number entered in the text forum
#specify the context to make the outgoing call from.  By default, AAH uses from-internal
#Using from-internal will make you outgoing dialing rules apply
$strContext "callme";
#specify the amount of time you want to try calling the specified channel before hangin up
$strWaitTime "30";
#specify the priority you wish to place on making this call
$strPriority "1";
#specify the maximum amount of retries
$strMaxRetry "2";
#--------------------------------------------------------------------------------------------
#Shouldn't need to edit anything below this point to make this script work
#--------------------------------------------------------------------------------------------
#get the phone number from the posted form
$strExten $_POST['txtphonenumber'];
#specify the caller id for the call
$strCallerId "AVS <18005555555>";
$length strlen($strExten);
if (
$length == 11 && is_numeric($strExten))
{
$oSocket fsockopen($strHost5038$errnum$errdesc) or die("Connection to host failed");
fputs($oSocket"Action: login\r\n");
fputs($oSocket"Events: off\r\n");
fputs($oSocket"Username: $strUser\r\n");
fputs($oSocket"Secret: $strSecret\r\n\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: $strExten\r\n");
fputs($oSocket"Context: $strContext\r\n");
fputs($oSocket"Priority: $strPriority\r\n\r\n");
fputs($oSocket"Action: Logoff\r\n\r\n");
fclose($oSocket);
?> 

I think I just need to replace the code in this section, how can I get the phone number from the text forum, into this so my asterisk box will know where to direct the call
PHP Code:
$strChannel "SIP/15554445555@voipinvite"this is the telephone number the asterisk server will call.  I would like to replace this number with the phone number entered in the text forum 
__________________
Denny Zebrowski

Please login or register to view this content. Registration is FREE
acceleratedvs is offline
Reply With Quote
View Public Profile Visit acceleratedvs's homepage!
 
 
Register now for full access!
Old 09-23-2008, 03:38 AM Re: click to call using PHP
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
OMG. These guys don't want to use the brain at all.
PHP Code:
$strChannel "SIP/{$_POST['phonenumber']}@voipinvite"
Assuming that you have a form with POST method and phonenumber text field.

And BTW, what is this:
PHP Code:
#get the phone number from the posted form
$strExten $_POST['txtphonenumber']; 
???77
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 09-23-2008, 11:13 PM Re: click to call using PHP
Novice Talker

Posts: 8
Name: Denny Zebrowski
Location: Atlanta
Trades: 0
Apologize for the lack of using my brain...I have zero understanding of PHP...but I do thank you for the knowledge and wisdom you have graced me with..I'll add it to my brain..add this to yours..

PHP Code:
$strExten $_POST['txtphonenumber']; 


In the current script it takes the phone number from the php script and post it into my asterisk extension.conf dial plan
__________________
Denny Zebrowski

Please login or register to view this content. Registration is FREE
acceleratedvs is offline
Reply With Quote
View Public Profile Visit acceleratedvs's homepage!
 
Reply     « Reply to click to call using PHP
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11623 seconds with 12 queries