[Freeswitch-users] Making a Call from PHP

Michael Collins msc at freeswitch.org
Fri Jan 21 00:35:47 MSK 2011


I believe we talked about this on IRC but for posterity's sake I'll repeat
here: your originate syntax is not correct. It can be confusing because
there are several ways to accomplish the same thing. In your case I
recommend using this syntax:

api originate user/1000 1001

The first argument to originate is a dialstring. If you know that you are
going to be dialing a locally registered user then the "user" channel is
easier than saying "sofia/internal/1000%${domain}". The second argument to
originate is a dialplan extension or and application to execute. In the
above example the first leg calls user/1000 and when he/she answers it then
sends the other leg through the dialplan as if user 1000 had dialed "1001"
and pressed send. I hope that makes sense.

Let us know if you continue to have issues with this. You are VERY close to
having this working - just a few characters in the dialstring.

-MC

On Thu, Jan 20, 2011 at 1:10 PM, Peter Brenner <peter at phpwerks.com> wrote:

> Very new to Freeswitch and I am trying to work through some examples of
> connecting/interacting with Freeswitch from PHP.  The example that I am
> trying to work through is one where a user enters 2 extension numbers on
> a page, submits the page which then originates a call from one extension
> to the other.
>
> I used the follow in example as a starting point:
>
> http://wiki.freeswitch.org/wiki/PHP_Event_Socket
> I changed the command:
> $cmd = "api help";
>
> To:
>
> $cmd = "api originate sofia/internal/1000&bridge(sofia/internal/1001)";
>
> I want to call from extension 1000 to 1001
>
> I receive the following error
>
> 2011-01-20 16:01:16.482373 [WARNING] mod_sofia.c:4022 Cannot locate
> registered user 1000 at internal
> 2011-01-20 16:01:16.482373 [NOTICE] mod_sofia.c:4221 Close Channel N/A
> [CS_NEW]
> 2011-01-20 16:01:16.482373 [ERR] switch_ivr_originate.c:2628 Cannot create
> outgoing channel of type [sofia] cause: [USER_NOT_REGISTERED]
>
> If I change the command to
> $cmd = "api originate sofia/internal/1000 at 192.168.1.211
> &bridge(sofia/internal/1001)";
>
>
> 2011-01-20 16:04:00.602758 [NOTICE] switch_channel.c:808 New Channel
> sofia/internal/1000 at 192.168.1.211 [c721e1e2-7eb7-46d5-9507-dcf02ac33828]
> 2011-01-20 16:04:00.602758 [NOTICE] switch_channel.c:808 New Channel
> sofia/internal/0000000000 at 192.168.1.211[b7b163eb-3c90-4b86-9fde-070abdfbb45b]
> 2011-01-20 16:04:00.612832 [INFO] mod_dialplan_xml.c:331
> Processing<0000000000>->1000 in context public
> 2011-01-20 16:04:00.625071 [ERR] sofia.c:5869 Cannot Blind Transfer 1
> Legged calls
> 2011-01-20 16:04:00.625071 [NOTICE] sofia.c:5286 Hangup sofia/internal/
> 1000 at 192.168.1.211 [CS_CONSUME_MEDIA] [NO_USER_RESPONSE]
> 2011-01-20 16:04:00.654406 [NOTICE] switch_core_session.c:1306 Session 2
> (sofia/internal/1000 at 192.168.1.211) Ended
> 2011-01-20 16:04:00.654406 [NOTICE] switch_core_session.c:1308 Close
> Channel sofia/internal/1000 at 192.168.1.211 [CS_DESTROY]
> 2011-01-20 16:04:00.725081 [NOTICE] switch_core_state_machine.c:189
> sofia/internal/0000000000 at 192.168.1.211 has executed the last dialplan
> instruction, hanging up.
> 2011-01-20 16:04:00.725081 [NOTICE] switch_core_state_machine.c:191 Hangup
> sofia/internal/0000000000 at 192.168.1.211 [CS_EXECUTE] [NORMAL_CLEARING]
> 2011-01-20 16:04:00.730022 [NOTICE] switch_core_session.c:1306 Session 3
> (sofia/internal/0000000000 at 192.168.1.211) Ended
> 2011-01-20 16:04:00.730022 [NOTICE] switch_core_session.c:1308 Close
> Channel sofia/internal/0000000000 at 192.168.1.211 [CS_DESTROY]
>
> Here is the output from sofia status
>
>                      Name          Type
>   Data      State
>
> =================================================================================================
>                  external       profile
> sip:mod_sofia at 192.168.1.211:5080      RUNNING (0)
>     external::example.com       gateway
> sip:joeuser at example.com <sip%3Ajoeuser at example.com>      NOREG
>             internal-ipv6       profile                   sip:mod_sofia@[::1]:5060
>      RUNNING (0)
>                  internal       profile
> sip:mod_sofia at 192.168.1.211:5060      RUNNING (0)
>             192.168.1.211         alias
> internal      ALIASED
>
> =================================================================================================
> 3 profiles 1 alias
>
> Any advice or help would be greatly appreciated.
>
> thanks!
> Peter
>
>
>
> _______________________________________________
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20110120/83562d7e/attachment.html 


More information about the FreeSWITCH-users mailing list