Asterisk SendMessage不会转到WS

时间:2016-01-10 16:36:52

标签: webrtc asterisk sip

我使用SipJS lib和Asterisk 11.16作为后端实现了软件电话和WebRTC聊天。呼叫功能运行良好,但是当我使用SendMessage向基于WebRTC的对等方发送即时消息时,Asterisk正在从URI的域部分向IP端口5060发送SIP数据包。如果我将服务器域放在URI中,我会在服务器上获得无限循环接收和重发相同的消息,因为Asterisk不使用WS发送传出消息,而是默认SIP。根据我的理解,SendMessage应用程序只是忽略当前的SIP Peers信息,并且当Dial按预期工作时,通过WS查看uri。我还注意到,在sip.conf中应该将选项auth_message_requests设置为no以使消息进入循环,否则在第一次迭代之后它将被401代码拒绝,如下面的示例所示(WS传输的初始接收已被省略,XX。 XX.XX.XX是myasterisk.server.org的IP。 是否有任何选项可以强制SendMessage通过配置更改使用对等详细信息和WS传输,或者使用更新版本的星号来实现它?

    <------------>
        -- Executing [921@messages:2] NoOp("Message/ast_msg_queue", "To sip:921@myasterisk.server.org") in new stack
        -- Executing [921@messages:3] NoOp("Message/ast_msg_queue", "From "Golovchenko, Dmytro" <sip:920@myasterisk.server.org>") in new stack
        -- Executing [921@messages:4] NoOp("Message/ast_msg_queue", "Body test") in new stack
        -- Executing [921@messages:5] MessageSend("Message/ast_msg_queue", "sip:921@myasterisk.server.org,"Golovchenko, Dmytro" <sip:920@myasterisk.server.org>") in new stack
    Scheduling destruction of SIP dialog '4vg0rleqn8e2g32ct8pb' in 32000 ms (Method: MESSAGE)
    Reliably Transmitting (no NAT) to XX.XX.XX.XX:5060:
    MESSAGE sip:921@myasterisk.server.org SIP/2.0
    Via: SIP/2.0/UDP XX.XX.XX.XX:5060;branch=z9hG4bK535a7bae
    Max-Forwards: 70
    From: "Golovchenko, Dmytro" <sip:920@myasterisk.server.org>;tag=as112b7351
    To: <sip:921@myasterisk.server.org>
    Contact: <sip:920@XX.XX.XX.XX:5060>
    Call-ID: 462a6a3d38c2a72b22c70ba04622a1ce@127.0.1.1:5060
    CSeq: 102 MESSAGE
    User-Agent: Asterisk PBX 11.16.0
    Content-Type: text/plain;charset=UTF-8
    Content-Length: 4

    test
    ---
    Scheduling destruction of SIP dialog '462a6a3d38c2a72b22c70ba04622a1ce@127.0.1.1:5060' in 32000 ms (Method: MESSAGE)
        -- Executing [921@messages:6] NoOp("Message/ast_msg_queue", "Send status is SUCCESS") in new stack
        -- Executing [921@messages:7] GotoIf("Message/ast_msg_queue", "0?sendfailedmsg") in new stack
        -- Executing [921@messages:8] Hangup("Message/ast_msg_queue", "") in new stack
      == Spawn extension (messages, 921, 8) exited non-zero on 'Message/ast_msg_queue'

    <--- SIP read from UDP:XX.XX.XX.XX:5060 --->
    MESSAGE sip:921@myasterisk.server.org SIP/2.0
    Via: SIP/2.0/UDP XX.XX.XX.XX:5060;branch=z9hG4bK535a7bae
    Max-Forwards: 70
    From: "Golovchenko, Dmytro" <sip:920@myasterisk.server.org>;tag=as112b7351
    To: <sip:921@myasterisk.server.org>
    Contact: <sip:920@XX.XX.XX.XX:5060>
    Call-ID: 462a6a3d38c2a72b22c70ba04622a1ce@127.0.1.1:5060
    CSeq: 102 MESSAGE
    User-Agent: Asterisk PBX 11.16.0
    Content-Type: text/plain;charset=UTF-8
    Content-Length: 4

    test
    <------------->
    --- (11 headers 1 lines) ---
    Sending to XX.XX.XX.XX:5060 (no NAT)
    Receiving message!
    Found peer '920' for '920' from XX.XX.XX.XX:5060

    <--- Transmitting (NAT) to XX.XX.XX.XX:5060 --->
    SIP/2.0 401 Unauthorized
    Via: SIP/2.0/UDP XX.XX.XX.XX:5060;branch=z9hG4bK535a7bae;received=XX.XX.XX.XX;rport=5060
    From: "Golovchenko, Dmytro" <sip:920@myasterisk.server.org>;tag=as112b7351
    To: <sip:921@myasterisk.server.org>;tag=as1b701310
    Call-ID: 462a6a3d38c2a72b22c70ba04622a1ce@127.0.1.1:5060
    CSeq: 102 MESSAGE
    Server: Asterisk PBX 11.16.0
    Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
    Supported: replaces, timer
    WWW-Authenticate: Digest algorithm=MD5, realm="XX.XX.XX.XX", nonce="028de78a"
    Content-Length: 0


    <------------>
    Scheduling destruction of SIP dialog '462a6a3d38c2a72b22c70ba04622a1ce@127.0.1.1:5060' in 32000 ms (Method: MESSAGE)
    Scheduling destruction of SIP dialog '462a6a3d38c2a72b22c70ba04622a1ce@127.0.1.1:5060' in 32000 ms (Method: MESSAGE)

    <--- SIP read from UDP:XX.XX.XX.XX:5060 --->
    SIP/2.0 401 Unauthorized
    Via: SIP/2.0/UDP XX.XX.XX.XX:5060;branch=z9hG4bK535a7bae;received=XX.XX.XX.XX;rport=5060
    From: "Golovchenko, Dmytro" <sip:920@myasterisk.server.org>;tag=as112b7351
    To: <sip:921@myasterisk.server.org>;tag=as1b701310
    Call-ID: 462a6a3d38c2a72b22c70ba04622a1ce@127.0.1.1:5060
    CSeq: 102 MESSAGE
    Server: Asterisk PBX 11.16.0
    Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
    Supported: replaces, timer
    WWW-Authenticate: Digest algorithm=MD5, realm="XX.XX.XX.XX", nonce="028de78a"
    Content-Length: 0

    <------------->
    --- (11 headers 0 lines) ---
    Really destroying SIP dialog '462a6a3d38c2a72b22c70ba04622a1ce@127.0.1.1:5060' Method: MESSAGE

0 个答案:

没有答案