星号MessageSend使用PJSIP发送到多个设备

时间:2018-08-22 14:52:03

标签: webrtc asterisk sip pjsip

我目前使用WebRTC->星号进行设置,可以在其中打电话和发送消息。当我从A-> B拨打电话时,B的所有注册设备都会被呼叫(因此,如果他已登录多次)。

但是,使用MessageSend只能将SIP消息传递给一个已注册的人,而不是全部。如何使其发送到所有已注册的设备?

是否有可能在星号内部完成其他操作?

(使用星号15.5)。

谢谢!

1 个答案:

答案 0 :(得分:0)

星号(至少在使用PJSIP时)和给定的终结点会删除所有URI详细信息,并且只会使用终结点并且不会在所有已注册的联系人上循环。

从messge.c'msg_send_exec' 从res_pjsip_messaging.c'get_outbound_endpoint'获取出站

/* attempt to extract the endpoint name */
if ((aor_uri = strchr(name, '/'))) {
    /* format was 'endpoint/(aor_name | uri)' */
    *aor_uri++ = '\0';
} else if ((aor_uri = strchr(name, '@'))) {
    /* format was 'endpoint@domain' - discard the domain */
    *aor_uri = '\0';

    /*
     * We may want to match without any user options getting
     * in the way.
     */
    AST_SIP_USER_OPTIONS_TRUNCATE_CHECK(name);
}

/* at this point, if name is not empty then it
   might be an endpoint, so try to retrieve it */
if (ast_strlen_zero(name)
    || !(endpoint = ast_sorcery_retrieve_by_id(ast_sip_get_sorcery(), "endpoint",
        name))) {
    /* an endpoint was not found, so assume sending directly
       to a uri and use the default outbound endpoint */
    *uri = ast_strdup(to);
    return ast_sip_default_outbound_endpoint();
}

根据我的理解,如果仅使用URI(例如pjsip:123.12.123.12:1234),它将查找默认端点,该端点将始终保持不变。