[asterisk-users] AMI originate and PHP

Jarrod Lash jarrod at fed-com.com
Wed Dec 23 18:03:10 CST 2009


Bruce,

What I have done for apps like this is call the first guy and at the
end of your dialplan put him in a meetme room.  In your script watch
for the meetme room to be created in the AMI output.

Once the room is created originate a call to the other guy and dump
him into that meetme room when he answers.


-- 
Jarrod Lash, <jarrod at fed-com.com>
Federated Communications, LLC.
www.fed-com.com
Office: +1-412-357-2127
Mobile: +1-412-999-0049
Fax: +1-412-545-8368


On Wed, Dec 23, 2009 at 6:19 PM, Bruce Nik <brucevoip at gmail.com> wrote:
> Hi Guys,
> I am trying to make a web form where a person is allowed to put in
> $phoneNumber, $dialNumber, and $spoofNumber to make a call with spoof caller
> ID. There are a few problems that I am facing with Asterisk AMI Originate
> command. The reason why I want to use the darn AMI Originate is because I am
> sending calls to mobile phones and I want to have some accountability and to
> know if a call was connected for billing purposes or not. Calls go to PSTN
> through SIP provider so all signaling is available.
> First, if i use AMI Originate to dial both parties with the set CallerID
> then, one party may pick up than the other and channel is not bridged at
> ringing. So, this can confuse the callee. So, I thought I should send calls
> to a context first and then ask customer enter $spoofNumber and then place
> call but then I am facing another problem. Using that, the internal context
> is called first and all announcements are made and then the
> SIP/sipProvider/$phoneNumb is dialed. Or at least it's dialed at the same
> time but since it takes time to pick ones phone context already goes over
> it's announcement for putting in spoof number and dialnumber. Please guide
> me how to do this properly. Following is the code and the context:
> $sys_ip = "127.0.0.1";
> $User_str = "test";
> $Secret_str = "test";
> $phoneNumb = "14167777777";
> $dialNumb = "14168888888";
> $spoofNumb = "1416999999";
> $oSocket = fsockopen($sys_ip, 5038, $errnum, $errdesc) or die("Connection to
> host failed");
> fputs($oSocket, "Action: login\r\n");
> fputs($oSocket, "Username: $User_str\r\n");
> fputs($oSocket, "Secret: $Secret_str\r\n\r\n");
> fputs($oSocket, "Events: off\r\n\r\n");
> fputs($oSocket, "Action: originate\r\n");
> fputs($oSocket, "Channel: SIP/testTrunk/$phoneNumb\r\n");
> fputs($oSocket, "Exten: $dialNumb\r\n");
> fputs($oSocket, "Context: testphp\r\n");
> fputs($oSocket, "Priority: 1\r\n\r\n");
> fputs($oSocket, "Timeout: 10000\r\n");
> fputs($oSocket, "CallerId: $spoofNumb\r\n");
> fputs($oSocket, "Async: true\r\n");
> fputs($oSocket, "Action: Logoff\r\n\r\n");
> fclose($oSocket);
>
> /etc/asterisk/extensions.conf
> [testphp]
> exten => _X.,1,Answer()
> exten =>
> _X.,n,Playback(/var/lib/asterisk/sounds/please_enter_dialnumber_and_spoof_callerid)
> exten => _X.,n,Read(dialnumber,,10)
> exten => _X.,n,Read(spoofnumber,,10)
> exten => _X.,n,Playback(connecting_now)
> exten => _X.,n,Dial(SIP/testTrunk/$dialNumb)
> exten => _X.,n,Hangup()
> Thanks a lot.
> _______________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-users
>



More information about the asterisk-users mailing list