I am trying to send a simple sms chat through fs_cli using the chat api. This chat is intended to stay local within the same domain from one registered extension to another registered extension. I intend to be delivering a message on the phone. The end result really is desiring a dialplan which will be executed if, for example, ext 101 calls 102, then extension 103 will receive a message “101 is busy calling 102” as a simple example. Determining how to do this from fs_cli is my natural progression on trying to understand and use the most simple (hopefully) of methods.
If I use the messaging/chat functionality on a phone (yealink or gs wave softphone for example) or from the phone’s embedded web server, the chats are sent and received successfully. However, if I try to send via fs_cli’s chat API it does not work.
- enter fs command line
fs_cli
- view the chat api method
show api chat
This displays:
name,description,syntax,ikey
chat,chat,<proto>|<from>|<to>|<message>|[<content-type>],mod_dptools
- send a chat
chat global|4015@customer1.domain.tld|4015@customer1.domain.tld|hello, did this message send and receive?
This results in the error: Error! Message Not Sent
If I use “sip”, “internal”, or similar as the field then I receive the error message that the ‘customer1.domain.tld’ is an invalid profile.
2023-01-03 19:23:28.726341 [ERR] sofia_presence.c:200 Chat proto [global]
from [4015@customer1.domain.tld]
to [4015@customer1.domain.tld]
hello, did this message send and receive?
Invalid Profile customer1.domain.tld
customer1.domain.tld is substituted herein for a valid domain.
If I send an sms message through gs wave softphone and watch sngrep the message is sent and received. Here is the sngrep raw data
2023/01/03 20:14:07.653170 <my_ip_address>:28607 -> <server_ip_address>:5070
MESSAGE sip:4015@customer1.domain.tld SIP/2.0
Via: SIP/2.0/UDP <my_ip_address>:28607;branch=z9hG4bK1052834227;rport
From: <sip:101@customer1.domain.tld>;tag=1222145213
To: <sip:4015@customer1.domain.tld>
Call-ID: 801578727-28607-17@<server_ip_address>
CSeq: 160 MESSAGE
Contact: <sip:101@<my_ip_address>:28607>
Max-Forwards: 70
User-Agent: Grandstream Wave 1.0.3.34
Supported: replaces, path, timer, eventlist
Allow: INVITE, ACK, OPTIONS, CANCEL, BYE, SUBSCRIBE, NOTIFY, INFO, REFER, UPDATE, MESSAGE
Content-Type: text/plain; charset=UTF-8
Content-Length: 37
this message was sent through gs wave softphone
2023/01/03 20:14:07.675282 <server_ip_address>:5070 -> <my_ip_address>:28607
SIP/2.0 202 Accepted
Via: SIP/2.0/UDP <my_ip_address>:28607;branch=z9hG4bK1052834227;rport=28607
From: <sip:101@customer1.domain.tld>;tag=1222145213
To: <sip:4015@customer1.domain.tld>;tag=7p3grZSU7Fa6m
Call-ID: 801578727-28607-17@<server_ip_address>
CSeq: 160 MESSAGE
Contact: <sip:<server_ip_address>:5070>
User-Agent: FreeSWITCH
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: timer, path, replaces
Content-Length: 0
From here I have been able to run the show chat
fs_cli command and result in:
type,name,ikey
chat,GLOBAL_SMS,mod_sms
chat,api,mod_dptools
chat,conf,mod_conference
chat,event,mod_dptools
chat,sip,mod_sofia
If I change my chat ....
command to chat api|......
or chat event|.....
from the show chat results above, then I receive a Sent message but I do not receive the message on the softphone application. GLOBAL_SMS, conf, sip do not work.
Many thanks in advance for input!