FreeSWITCH 之 chat
要把 FreeSWITCH 之 chat 完全讲清楚,似乎不容易
发送,路由,接收
跟哪些模块有关
等等
一边查资料,一边整理吧,不必着急
先看看 Kamalio 怎么发 MESSAGE
$uac_req(method) = "MESSAGE";
$uac_req(ruri) = "sip:10.0.1.5:5060";
$uac_req(furi) = "sip:Emergency Alert";
$uac_req(turi) = "sip:thisphone";
# $uac_req(callid) =
$uac_req(hdrs) = "Subject: Emergency Alert\r\n";
$uac_req(hdrs) = $uac_req(hdrs) + "Content-Type: text/plain\r\n";
$uac_req(body) = "hi\r\n";
$uac_req(evroute) = 1; # fire 路由
uac_req_send();
也可以设置 outbound proxy
$uac_req(ouri) = ...;
现在来看看 FS 怎么发送 MESSAGE
先看看 mod_sms
local event = freeswitch.Event("CUSTOM", "SMS::SEND_MESSAGE");
event:addHeader("proto", "sip");
event:addHeader("dest_proto", "sip");
event:addHeader("from", "1004@192.168.0.81");
event:addHeader("from_full", "sip:1004@192.168.0.81");
event:addHeader("to", "sip:1019@192.168.0.81");
event:addHeader("subject", "sip:1019@192.168.0.81");
event:addHeader("type", "text/html");
event:addHeader("hint", "the hint");
event:addHeader("replying", "true");
event:addHeader("sip_profile", "external");
event:addBody("Hi\r\n");-- freeswitch.consoleLog("info", event:serialize());
event:fire();
要怎么设置 proxy呢?
笔者查了半天资料,终于找到了答案,可参考下面这个头:
contact-uri: sip:1002@192.168.0.99:11710;fs_path=sip:192.168.207.156:5060
重点是不要加 `<>`,加了就不好使
上面讲的是发送对话外 MESSAGE
那么对话内 MESSAGE 要怎么发送呢?
要研究下,除了 uuid_chat 是否还有别的?
还有个问题需要研究下,就是可以 blocking 发送,也可以 not-blocking 发送