[Freeswitch-users] How to send sip MESSAGE from script

Chad Engler Chad.Engler at patlive.com
Tue Oct 16 20:38:19 MSD 2012


Don't specify a port in the provider option of the configuration, use
freeswitch configuration to route the messages to different ports based
on profile. I notice that I am unable to send a message through my
provider if I set the port in the provider option (even though it is the
right port) but if I leave it off it works fine.

 

I believe internal default port is 5060, so leave off the port of
provider in your config.json file. And ensure your softphone is
listening to the correct port for use with your sip profile.

 

-Chad

 

From: freeswitch-users-bounces at lists.freeswitch.org
[mailto:freeswitch-users-bounces at lists.freeswitch.org] On Behalf Of Khue
Nguyen Minh
Sent: Tuesday, October 16, 2012 12:19 PM
To: FreeSWITCH Users Help
Subject: Re: [Freeswitch-users] How to send sip MESSAGE from script

 

When I send message from website, I don't see anything in fs_cli. I was
set log level to 7. If I send sip MESSAGE from soft phone, have some
error:

 

	2012-10-16 20:12:45.256306 [WARNING] sofia_presence.c:204 Not
sending to local box for 9910 at 192.168.0.24

	freeswitch at 192.168.0.24@internal> [DEBUG] esl.c:1242
esl_recv_event() RECV HEADER [Content-Type] = [log/data]

	[DEBUG] esl.c:1242 esl_recv_event() RECV HEADER [Content-Length]
= [220]

	[DEBUG] esl.c:1242 esl_recv_event() RECV HEADER [Log-Level] =
[3]

	[DEBUG] esl.c:1242 esl_recv_event() RECV HEADER [Text-Channel] =
[0]

	[DEBUG] esl.c:1242 esl_recv_event() RECV HEADER [Log-File] =
[sofia_presence.c]

	[DEBUG] esl.c:1242 esl_recv_event() RECV HEADER [Log-Func] =
[sofia_presence_chat_send]

	[DEBUG] esl.c:1242 esl_recv_event() RECV HEADER [Log-Line] =
[253]

	[DEBUG] esl.c:1242 esl_recv_event() RECV HEADER [User-Data] = []

	[DEBUG] esl.c:1412 esl_recv_event() RECV MESSAGE

	Event-Name: SOCKET_DATA

	Content-Type: log/data

	Content-Length: 220

	Log-Level: 3

	Text-Channel: 0

	Log-File: sofia_presence.c

	Log-Func: sofia_presence_chat_send

	Log-Line: 253

	Content-Length: 220

	 

	2012-10-16 20:12:45.256306 [ERR] sofia_presence.c:253 Chat proto
[sip]

	from ["0984713985" <sip:0984713985 at 192.168.0.24
<mailto:sip%3A0984713985 at 192.168.0.24>
>;tag=0779873085E5A6EA048CDC208A05DE19]

	to [9910 at 192.168.0.24]

	hi

	Nobody to send to: Profile internal

 

Brs,

Khue.

 

2012-10-16 20:12:45.256306 [ERR] sofia_presence.c:253 Chat proto [sip]

from ["0984713985" <sip:0984713985 at 192.168.0.24
<mailto:sip%3A0984713985 at 192.168.0.24>
>;tag=0779873085E5A6EA048CDC208A05DE19]

to [9910 at 192.168.0.24]

hi

Nobody to send to: Profile internal

freeswitch at 192.168.0.24@internal> 

 

2012/10/16 Chad Engler <Chad.Engler at patlive.com>

Try using `/debug 7` in `fs_cli` and see what errors it gives you. The
module is doing its job, the SIP MESSAGE is being sent, but it is not
reaching your software probably due to a network/configuration error.

 

-Chad 

 

From: freeswitch-users-bounces at lists.freeswitch.org
[mailto:freeswitch-users-bounces at lists.freeswitch.org] On Behalf Of Khue
Nguyen Minh
Sent: Tuesday, October 16, 2012 11:15 AM


To: FreeSWITCH Users Help
Subject: Re: [Freeswitch-users] How to send sip MESSAGE from script

 

Hi Chad,

 

I was changed my config as you guide but I still isn't work. Please see
attack file, it is log of chatty application. I explain my test:

 

EyeBeam run on ip: 192.168.0.35 and registered to FreeSWITCH with
number: 0984713985

FreeSWITCH and Chatty run on ip: 192.168.0.24

 

1. I used softphone to send a instant message "hello" to extension 9910,
>From website, I can receive it.

2. From chat window on website, I send "how are you", softphone don't
receive it.

 

Brs,

Khue.

 

2012/10/16 Chad Engler <Chad.Engler at patlive.com>

So the chatty application will use the "provider" specified in its
configuration as the "to host" for the message:

 

                self.fsw.message(num + '@' + self.provider, self.from,
self.profile, msg, function(evt) {

 

So if you have "sms-proxy.yourprovider.com" as your provider in the
config (which is the default example) then that is the domain it is
trying to send the message to. Try changing provider in the
configuration to the host that your softphone is on and restarting the
app. If it still isn't working attach a dump of the output of the chatty
application and I will try and see what is happening.

 

-Chad

 

From: freeswitch-users-bounces at lists.freeswitch.org
[mailto:freeswitch-users-bounces at lists.freeswitch.org] On Behalf Of Khue
Nguyen Minh
Sent: Monday, October 15, 2012 11:08 PM


To: FreeSWITCH Users Help
Subject: Re: [Freeswitch-users] How to send sip MESSAGE from script

 

Hi Chad,

 

Thanks you very much. It work fine.

 

Now, I can send "Instant Message" from softphone (eyebeam) and receive
it in website. But, softphone cannot receive anything that sent from
website. How I can receive message that sent from website? 

 

Thanks & Best regards,

Khue.

2012/10/15 Chad Engler <Chad.Engler at patlive.com>

After some research it looks like Expressjs and Socket.IO have some
issues working together on node v0.9+. For now if you can use v0.8 that
will fix your issue, but I am looking into a solution for v0.9+ and
track some bugs.

 

Thanks for the heads up!

 

-Chad

 

From: freeswitch-users-bounces at lists.freeswitch.org
[mailto:freeswitch-users-bounces at lists.freeswitch.org] On Behalf Of Khue
Nguyen Minh
Sent: Monday, October 15, 2012 9:43 AM
To: FreeSWITCH Users Help


Subject: Re: [Freeswitch-users] How to send sip MESSAGE from script

 

Hi Chad,

 

I used node version 0.9.3-pre. This is config.json:

{

    "fsw": {

        "host": "192.168.0.24",

        "port": 8021,

        "password": "ClueCon"

    },

    "server": {

        "host": "192.168.0.24",

        "port": 8181,

        "provider": "sms-proxy.yourprovider.com",

        "from": "from_number at from_host",

        "profile": "external"

    }

}

 

and chatplan:

<?xml version="1.0" encoding="utf-8"?>

<include>

  <context name="default">

 

    <extension name="demo">

      <condition field="to" expression="^(.*)$">

      

        <action application="fire" data=""/>

       

      </condition>

    </extension>

 

  </context>

</include>

 

Brs,

Khue.

 

2012/10/15 Chad Engler <Chad.Engler at patlive.com>

It would also be nice to see your config.json in the root of the chatty
directory.

 

-Chad

 

From: Chad Engler 
Sent: Monday, October 15, 2012 8:48 AM
To: FreeSWITCH Users Help
Subject: RE: [Freeswitch-users] How to send sip MESSAGE from script

 

Khue,

 

What version of node are you running? Can I also see your chatplan?

 

Thanks,

Chad

 

From: freeswitch-users-bounces at lists.freeswitch.org
[mailto:freeswitch-users-bounces at lists.freeswitch.org] On Behalf Of Khue
Nguyen Minh
Sent: Friday, October 12, 2012 11:44 PM
To: FreeSWITCH Users Help
Subject: Re: [Freeswitch-users] How to send sip MESSAGE from script

 

Hi Chad,

 

I installed node-esl and tried it. But, I have some error:

1.	When I enter url: http://my_ip:8181, chatty stopped immediately
with error:

	http.js:650

	    throw new Error('Can\'t set headers after they are sent.');

	          ^

	Error: Can't set headers after they are sent.

	    at ServerResponse.OutgoingMessage.setHeader (http.js:650:11)

	    at ServerResponse.res.setHeader
(/opt/englercj-node-esl-50aba9e/examples/chatty/node_modules/express/nod
e_modules/connect/lib/patch.js:59:22)

	    at SendStream.type
(/opt/englercj-node-esl-50aba9e/examples/chatty/node_modules/express/nod
e_modules/connect/node_modules/send/lib/send.js:444:7)

	    at SendStream.send
(/opt/englercj-node-esl-50aba9e/examples/chatty/node_modules/express/nod
e_modules/connect/node_modules/send/lib/send.js:343:8)

	    at
/opt/englercj-node-esl-50aba9e/examples/chatty/node_modules/express/node
_modules/connect/node_modules/send/lib/send.js:319:10

	    at Object.oncomplete (fs.js:308:15)

	    at process._makeCallback (node.js:248:20)

1.	In fs_cli have error:

	2012-10-13 06:56:01.476306 [WARNING] sofia_presence.c:204 Not
sending to local box for  9910 at 192.168.0.24

	2012-10-13 06:56:01.476306 [ERR] sofia_presence.c:253 Chat proto
[sip]

	from ["1000" <sip:1000 at 192.168.0.24
<mailto:sip%3A1000 at 192.168.0.24> >;tag=7700467a]

	to [9910 at 192.168.0.24]

	<FONT size=2 face=Arial>how are you?</FONT>

	Nobody to send to: Profile internal

please help me fix it.

 

Thanks& Best regards,

Khue

 

 

2012/10/12 Chad Engler <Chad.Engler at patlive.com>

Hello,

 

Check out https://github.com/englercj/node-esl

 

Thanks,

 

Chad

 

From: freeswitch-users-bounces at lists.freeswitch.org
[mailto:freeswitch-users-bounces at lists.freeswitch.org] On Behalf Of Khue
Nguyen Minh
Sent: Friday, October 12, 2012 5:01 AM
To: FreeSWITCH Users Help
Subject: [Freeswitch-users] How to send sip MESSAGE from script

 

Hi all,

 

I want send message "MESSAGE" to caller from javascript. How I can do
it, please guide me?

 

Brs,

Khue.


________________________________________________________________________
_
Professional FreeSWITCH Consulting Services:
consulting at freeswitch.org
http://www.freeswitchsolutions.com




Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

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

 


________________________________________________________________________
_
Professional FreeSWITCH Consulting Services:
consulting at freeswitch.org
http://www.freeswitchsolutions.com




Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

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

 


________________________________________________________________________
_
Professional FreeSWITCH Consulting Services:
consulting at freeswitch.org
http://www.freeswitchsolutions.com




Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

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

 


________________________________________________________________________
_
Professional FreeSWITCH Consulting Services:
consulting at freeswitch.org
http://www.freeswitchsolutions.com




Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

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

 


________________________________________________________________________
_
Professional FreeSWITCH Consulting Services:
consulting at freeswitch.org
http://www.freeswitchsolutions.com




Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

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/20121016/f40a806c/attachment-0001.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list