版本 FreeSWITCH Version 1.10.12-dev-5976~218a00e2e9~64bit (218a00e2e9 64bit)
Eyebeam 注册请求到 OpenSIPS, 后者 add_path 之后转发到 FreeSWITCH
fs_cli -x 'sofia global siptrace on'
fs_cli -x 'sofia loglevel all 9'
fs_cli -x 'chat sip|9999@192.168.31.166|1002@192.168.31.166|1111\r\nHello,opensips'
libs\sofia-sip\libsofia-sip-ua\nua\nua_stack.c:559 nua_signal() nua(0000019761685AF0): sent signal r_message
libs\sofia-sip\libsofia-sip-ua\nua\nua_stack.c:599 nua_stack_signal() nua(0000019761685AF0): recv signal r_message
libs\sofia-sip\libsofia-sip-ua\soa\soa.c:280 soa_clone() soa_clone(static::00000197607F3590, 00000197613F1EC0, 0000019761685AF0) called
libs\sofia-sip\libsofia-sip-ua\soa\soa.c:403 soa_set_params() soa_set_params(static::00000197607F2490, ...) called
libs\sofia-sip\libsofia-sip-ua\soa\soa.c:403 soa_set_params() soa_set_params(static::00000197607F2490, ...) called
libs\sofia-sip\libsofia-sip-ua\nta\nta.c:8160 outgoing_create() nta outgoing create: invalid URI
libs\sofia-sip\libsofia-sip-ua\nta\nta.c:8829 outgoing_free() nta: outgoing_free(000001975F8D9BA0)
libs\sofia-sip\libsofia-sip-ua\nua\nua_stack.c:301 nua_stack_event() nua(0000019761685AF0): event r_message 900 Internal error at d:\freeswitch\libs\sofia-sip\libsofia-sip-ua\nua\nua_client.c:713
libs\sofia-sip\libsofia-sip-ua\nua\nua_stack.c:599 nua_stack_signal() nua(0000019761685AF0): recv signal r_handle_unref
libs\sofia-sip\libsofia-sip-ua\nua\nua_stack.c:559 nua_signal() nua(0000019761685AF0): sent signal r_destroy
libs\sofia-sip\libsofia-sip-ua\nua\nua_stack.c:599 nua_stack_signal() nua(0000019761685AF0): recv signal r_destroy
libs\sofia-sip\libsofia-sip-ua\nua\nua_stack.c:559 nua_signal() nua(0000019761685AF0): sent signal r_handle_unref
libs\sofia-sip\libsofia-sip-ua\nta\nta.c:4550 nta_leg_destroy() nta_leg_destroy(0000000000000000)
libs\sofia-sip\libsofia-sip-ua\nua\nua_stack.c:559 nua_signal() nua(0000000000000000): sent signal r_unref
libs\sofia-sip\libsofia-sip-ua\soa\soa.c:356 soa_destroy() soa_destroy(static::00000197607F2490) called
libs\sofia-sip\libsofia-sip-ua\nua\nua_stack.c:559 nua_signal() nua(0000019761685AF0): sent signal r_handle_unref
libs\sofia-sip\libsofia-sip-ua\nua\nua_stack.c:559 nua_signal() nua(0000000000000000): sent signal r_unref
libs\sofia-sip\libsofia-sip-ua\nua\nua_stack.c:599 nua_stack_signal() nua(0000019761685AF0): recv signal r_handle_unref
libs\sofia-sip\libsofia-sip-ua\nua\nua_stack.c:599 nua_stack_signal() nua(0000000000000000): recv signal r_unref
libs\sofia-sip\libsofia-sip-ua\nua\nua_stack.c:599 nua_stack_signal() nua(0000000000000000): recv signal r_unref
Error! Message Not Sent
还得再研究下
暂时留意到 sofia_presence.c 里面调用如下:
nua_message(msg_nh,
TAG_IF(dst->route_uri, NUTAG_PROXY(dst->route_uri)),
TAG_IF(route_uri, NUTAG_PROXY(route_uri)),
TAG_IF(dst->route, SIPTAG_ROUTE_STR(dst->route)),
SIPTAG_FROM_STR(from),
TAG_IF(contact, NUTAG_URL(contact)),
SIPTAG_TO_STR(dup_dest),
SIPTAG_CALL_ID_STR(uuid_str),
TAG_IF(user_via, SIPTAG_VIA_STR(user_via)),
SIPTAG_CONTENT_TYPE_STR(ct),
SIPTAG_PAYLOAD_STR(body),
SIPTAG_HEADER_STR(header),
TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
TAG_END());
应该是 FreeSWITCH 的 bug,
没有 route 的时候工作的很好,
有 route 就歇菜。
再次研究,结果如下:
opensips 路由如下:
if (is_method("REGISTER")) {
add_path();
$du = "sip:192.168.31.166"; # fs
t_relay();
exit;
}
转发注册时自动带了一个 Path 头:
Path: <sip:192.168.31.213;lr>
fs 调用 chat api
dst->route_uri 为 <sip:192.168.31.213;lr>
传到 nta.c 的 8056 行 时
invalid = nta_tpn_by_url(home, orq->orq_tpn, &scheme, &port, route_url)
route_url 依然为 <sip:192.168.31.213;lr>
也就是尖括号没有删除
报 "invalid URI" 的错误,这个没毛病
结论就是 mod_sofia 处理 INVITE 时的 route 是没问题的
处理 chat 时的 route 是有问题的,得删除尖括号
有兴趣的读者可以给官方提 PR
全文完