首页 > 解决方案 > Asterisk MessageSend 使用 PJSIP 发送到多个设备

问题描述

我目前有一个使用 WebRTC -> Asterisk 的设置,我可以在其中调用和发送消息。当我从 A -> B 拨打电话时,B 的所有注册设备都会被调用(所以如果他多次登录)。

然而,使用 MessageSend SIP 消息只发送给一个注册的,而不是全部。我怎样才能让它发送到所有注册的设备?

是否有可能,如果没有,是否有任何其他方式可以在 Asterisk 内部完成?

(使用星号 15.5)。

谢谢!

标签: webrtcasterisksippjsip

解决方案


Asterisk(至少在使用 PJSIP 时)和给定的端点会去除任何 URI 详细信息,并且只会使用端点并且不会遍历所有已注册的联系人。

From 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),它只会查找始终相同的默认端点。


推荐阅读