[Freeswitch-users] CLI Chat Command

Kurtis Heimerl kheimerl at cs.berkeley.edu
Tue May 31 03:14:36 MSD 2011


Hello Freeswitch-users!

I, for the life of me, cannot figure out how to send a SIP MESSAGE to
a connected client. I've pored over a variety of mailing lists
(primarily this one), wiki pages, and source code. It still doesn't
make any sense. This email contains the wide variety of ways to do
this i've seen on these media, but I still have yet to see any actual
messages sent. Any ideas would be appreciated, i've started tearing
apart mod_sofia, and I feel like that's going to take a long long
time.

I'll lead with the current status, as there's likely debugging info
there. I have just one client, IMSI641104878332498 and I want to send
a message to and from him/her from fs_cli.

freeswitch at internal> sofia status profile internal
=================================================================================================
Name             	internal
Domain Name      	N/A
Auto-NAT         	false
DBName           	sofia_reg_internal
Pres Hosts       	192.168.1.144,192.168.1.144
Dialplan         	XML
Context          	public
Challenge Realm  	auto_from
RTP-IP           	192.168.1.144
SIP-IP           	192.168.1.144
URL              	sip:mod_sofia at 192.168.1.144:5060
BIND-URL         	sip:mod_sofia at 192.168.1.144:5060
HOLD-MUSIC       	local_stream://moh
OUTBOUND-PROXY   	N/A
CODECS IN        	G7221 at 32000h,G7221 at 16000h,G722,PCMU,PCMA,GSM
CODECS OUT       	G7221 at 32000h,G7221 at 16000h,G722,PCMU,PCMA,GSM
TEL-EVENT        	101
DTMF-MODE        	rfc2833
CNG              	13
SESSION-TO       	0
MAX-DIALOG       	0
NOMEDIA          	false
LATE-NEG         	false
PROXY-MEDIA      	false
AGGRESSIVENAT    	false
STUN-ENABLED     	true
STUN-AUTO-DISABLE	false
CALLS-IN         	0
FAILED-CALLS-IN  	0
CALLS-OUT        	0
FAILED-CALLS-OUT 	0

Registrations:
=================================================================================================
Call-ID:    	1562658417 at 192.168.1.144
User:       	IMSI641104878332498 at 192.168.1.144
Contact:    	IMSI641104878332498 <sip:IMSI641104878332498 at 192.168.1.144:5063>
Agent:      	unknown
Status:     	Registered(UDP)(unknown) EXP(2011-05-30 17:52:00) EXPSECS(6706)
Host:       	darth-maul
IP:         	192.168.1.144
Port:       	5063
Auth-User:  	unknown
Auth-Realm: 	192.168.1.144
MWI-Account:	IMSI641104878332498 at 192.168.1.144

Total items returned: 1
=================================================================================================

Firstly, the basic item from the wiki failed:

freeswitch at internal> chat
sip|IMSI641104878332498 at 192.168.1.144|IMSI641104878332498 at 192.168.1.144|foo
Sent
nua: nh_create_handle: entering
freeswitch at internal> nua(0x7fb14c005170): creating handle 0x7fb14c03e300 failed
nua: nua_handle_bind: entering
nua: nua_message: entering
nua: nua_r_message with invalid handle (nil)

I initially hoped that the commands would map from originate, and
tried the following:

freeswitch at internal> chat
sip|user/IMSI641104878332498|user/IMSI641104878332498|foo
Error! Message Not Sent
freeswitch at internal> 2011-05-30 16:02:24.563454 [ERR]
sofia_presence.c:133 Chat proto [dp]
from [user/IMSI641104878332498]
to [user/IMSI641104878332498]
foo
Invalid Profile user

That's fine, user isn't a sip profile. Internal is though.

freeswitch at internal> chat
sip|internal/IMSI641104878332498|internal/IMSI641104878332498|foo
Error! Message Not Sent
freeswitch at internal> 2011-05-30 16:03:02.363461 [ERR]
sofia_presence.c:149 Can't find registered user
IMSI641104878332498 at internal

Why is it taking the profile and making it the host? I found this in
the source code (sofia_presence.c:129), so fine. That's on purpose. A
mailing list entry suggested adding sip: before the user, for some
reason. That seems to help:

freeswitch at internal> chat
sip|internal/sip:IMSI641104878332498|internal/sip:IMSI641104878332498|foo
Sent

or

freeswitch at internal> chat
sip|internal/sip:IMSI641104878332498 at 192.168.1.144|internal/sip:IMSI641104878332498 at 192.168.1.144|foo
Sent

Success...   but not really. No message goes out (confirmed via
wireshark). Instead, nua fails for both of these:
nta outgoing create: invalid URI

What URI? My last option is to hard code everything:

freeswitch at internal> chat
sip|internal/IMSI641104878332498 at 192.168.1.144|internal/IMSI641104878332498 at 192.168.1.144|foo
Sent

Nua fails somewhere different with that one:
nua(0x7fb14c005170): creating handle 0x18577c0 failed
nua: nua_handle_bind: entering
nua: nua_message: entering
nua: nua_r_message with invalid handle (nil)

Lastly, adding the actual port only breaks things worse:

freeswitch at internal> chat
sip|internal/IMSI641104878332498 at 192.168.1.144:5063|internal/IMSI641104878332498 at 192.168.1.144:5063|foo
Error! Message Not Sent
2011-05-30 16:11:47.823468 [ERR] sofia_presence.c:149 Can't find
registered user IMSI641104878332498 at 192.168.1.144:5063

WHAT IS GOING ON?

Any help would be appreciated!



More information about the FreeSWITCH-users mailing list