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@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@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@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@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@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@192.168.1.211) Ended 2011-01-20 16:04:00.654406 [NOTICE] switch_core_session.c:1308 Close Channel sofia/internal/1000@192.168.1.211 [CS_DESTROY] 2011-01-20 16:04:00.725081 [NOTICE] switch_core_state_machine.c:189 sofia/internal/0000000000@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@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@192.168.1.211) Ended 2011-01-20 16:04:00.730022 [NOTICE] switch_core_session.c:1308 Close Channel sofia/internal/0000000000@192.168.1.211 [CS_DESTROY] Here is the output from sofia status Name Type Data State ================================================================================================= external profile sip:mod_sofia@192.168.1.211:5080 RUNNING (0) external::example.com gateway sip:joeuser@example.com NOREG internal-ipv6 profile sip:mod_sofia@[::1]:5060 RUNNING (0) internal profile sip:mod_sofia@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
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@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@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@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@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@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@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@192.168.1.211) Ended 2011-01-20 16:04:00.654406 [NOTICE] switch_core_session.c:1308 Close Channel sofia/internal/1000@192.168.1.211 [CS_DESTROY] 2011-01-20 16:04:00.725081 [NOTICE] switch_core_state_machine.c:189 sofia/internal/0000000000@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@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@192.168.1.211) Ended 2011-01-20 16:04:00.730022 [NOTICE] switch_core_session.c:1308 Close Channel sofia/internal/0000000000@192.168.1.211 [CS_DESTROY]
Here is the output from sofia status
Name Type Data State
================================================================================================= external profile sip:mod_sofia@192.168.1.211:5080 RUNNING (0) external::example.com gateway sip:joeuser@example.com <sip%3Ajoeuser@example.com> NOREG internal-ipv6 profile sip:mod_sofia@[::1]:5060 RUNNING (0) internal profile sip:mod_sofia@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@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Michael, Thank you for you response and suggestions. I tried using the syntax you provided but received this error [ERR] switch_ivr_originate.c:2628 Cannot create outgoing channel of type [error] cause: [USER_NOT_REGISTERED] Which indicates that I do not have a user registered. This is where I am lost, I have searched the documentation and can't determine how to register a user. I have softphone (xlite phone) configured with an account (user 1001 @ 192.168.1.254) from which I can make called to extensions. From PHP it fails. The phone is available when I attempt to run my php script. Is there a config setting I need to set? My freeswitch installation is a generic install with no modifications - the /conf/directory/default contains definitions for users 1000 - 1019 - these appear to get run by default.xml The ultimate goal for this test is to create a simple page that accepts a number, dials and connects to an internal number. Sorry for what is probably an elementary question, but any guidance would be greatly appreciated. Peter On 1/20/11 4:35 PM, Michael Collins wrote:
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@phpwerks.com <mailto:peter@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@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@192.168.1.211 <mailto:1000@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@192.168.1.211 <mailto:1000@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@192.168.1.211 <mailto:0000000000@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@192.168.1.211 <mailto:1000@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@192.168.1.211 <mailto:1000@192.168.1.211>) Ended 2011-01-20 16:04:00.654406 [NOTICE] switch_core_session.c:1308 Close Channel sofia/internal/1000@192.168.1.211 <mailto:1000@192.168.1.211> [CS_DESTROY] 2011-01-20 16:04:00.725081 [NOTICE] switch_core_state_machine.c:189 sofia/internal/0000000000@192.168.1.211 <mailto:0000000000@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@192.168.1.211 <mailto:0000000000@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@192.168.1.211 <mailto:0000000000@192.168.1.211>) Ended 2011-01-20 16:04:00.730022 [NOTICE] switch_core_session.c:1308 Close Channel sofia/internal/0000000000@192.168.1.211 <mailto:0000000000@192.168.1.211> [CS_DESTROY]
Here is the output from sofia status
Name Type Data State ================================================================================================= external profile sip:mod_sofia@192.168.1.211:5080 <http://sip:mod_sofia@192.168.1.211:5080> RUNNING (0) external::example.com <http://example.com> gateway sip:joeuser@example.com <mailto:sip%3Ajoeuser@example.com> NOREG internal-ipv6 profile sip:mod_sofia@[::1]:5060 RUNNING (0) internal profile sip:mod_sofia@192.168.1.211:5060 <http://sip:mod_sofia@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@lists.freeswitch.org <mailto:FreeSWITCH-users@lists.freeswitch.org> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
participants (2)
-
Michael Collins
-
Peter Brenner