[Freeswitch-users] Making a Call from PHP

Peter Brenner peter at phpwerks.com
Fri Jan 21 00:10:24 MSK 2011


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      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





More information about the FreeSWITCH-users mailing list