Messages with PJSIP are not delivered until channel is answered

Hi, I’m facing a issue while migrating to chan_pjsip.

Context:

  1. Doorbell calls asterisk extension.
  2. Asterisk establish a call with a phone (direct_media=no)
  3. In the phone I press a key to open door without answering the call. Then a MESSAGE is sent to asterisk.
  4. Message is not forwarded by asterisk to the doorbell.

With chan_sip it works fine, message is passed to the doorbell and it opens the door.
If I answer the call in the phone and press the open button, the message is delivered to the doorbell.

I tried to change endpoints parameters without success.

Any idea to make asterisk deliver message prior answering the call in PJSIP?


Tested on asterisk v16.12.0 and 18.0.1 (both with pjproject v2.10).

Doorbell call to asterisk (message missing):

         192.168.75.117:5060            192.168.75.1:5060   │
          ──────────┬─────────          ──────────┬─────────│
  10:22:33.117727   │        INVITE (SDP)         │         │
        +0.002008   │ ──────────────────────────> │         │
  10:22:33.119735   │      401 Unauthorized       │         │
        +0.006336   │ <────────────────────────── │         │
  10:22:33.126071   │             ACK             │         │
        +0.003909   │ ──────────────────────────> │         │
  10:22:33.129980   │        INVITE (SDP)         │         │
        +0.001968   │ ──────────────────────────> │         │
  10:22:33.131948   │         100 Trying          │         │
        +0.047536   │ <────────────────────────── │         │
  10:22:33.179484   │         180 Ringing         │         │
       +15.905034   │ <────────────────────────── │         │
  10:22:49.084518   │           CANCEL            │         │
        +0.001057   │ ──────────────────────────> │         │
  10:22:49.085575   │           200 OK            │         │
        +0.000151   │ <────────────────────────── │         │
  10:22:49.085726   │   487 Request Terminated    │         │
        +0.007084   │ <────────────────────────── │         │
  10:22:49.092810   │             ACK             │         │
                    │ ──────────────────────────> │

Call from asterisk to phone (message present):

                                                            │
            192.168.75.1:5060            192.168.75.106:5060│
          ──────────┬─────────          ──────────┬─────────│
  10:22:33.140981   │        INVITE (SDP)         │         │
        +0.018527   │ ──────────────────────────> │         │
  10:22:33.159508   │         100 Trying          │         │
        +0.015148   │ <────────────────────────── │         │
  10:22:33.174656   │         180 Ringing         │         │
       +11.873664   │ <────────────────────────── │         │
  10:22:45.048320   │           MESSAGE           │         │
        +0.001878   │ <────────────────────────── │         │
  10:22:45.050198   │        202 Accepted         │         │
        +4.036570   │ ──────────────────────────> │         │
  10:22:49.086768   │           CANCEL            │         │
        +0.018870   │ ──────────────────────────> │         │
  10:22:49.105638   │           200 OK            │         │
        +0.001816   │ <────────────────────────── │         │
  10:22:49.107454   │   487 Request Terminated    │         │
        +0.000856   │ <────────────────────────── │         │
  10:22:49.108310   │             ACK             │         │
                    │ ──────────────────────────> │         │

Message SDP:

<--- Received SIP request (735 bytes) from UDP:192.168.75.106:5060 --->
MESSAGE sip:Klunik@192.168.75.1:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.75.106:5060;branch=z9hG4bK1874850787;rport
From: <sip:201@192.168.75.106>;tag=1921973549
To: "PORTERO" <sip:299@192.168.75.1>;tag=e992e726-e644-4d48-91ac-34eaf2964e09
Call-ID: eff5f43e-b094-424e-aca8-b3c932289fdb
CSeq: 15436 MESSAGE
Contact: <sip:201@192.168.75.106:5060>
Max-Forwards: 70
Supported: replaces, path, timer
User-Agent: Grandstream GXP2135 1.0.11.16
Allow: INVITE, ACK, OPTIONS, CANCEL, BYE, SUBSCRIBE, NOTIFY, INFO, REFER, UPDATE, MESSAGE
Content-Type: text/plain; charset=UTF-8
Content-Length:   134

<?xml version="1.0" encoding="UTF-8"?>
<request id="72" type="gds_control">
<action>open door</action>
<action_attr/>
</request>

<--- Transmitting SIP response (356 bytes) to UDP:192.168.75.106:5060 --->
SIP/2.0 202 Accepted
Via: SIP/2.0/UDP 192.168.75.106:5060;rport=5060;received=192.168.75.106;branch=z9hG4bK1874850787
Call-ID: eff5f43e-b094-424e-aca8-b3c932289fdb
From: <sip:201@192.168.75.106>;tag=1921973549
To: "PORTERO" <sip:299@192.168.75.1>;tag=e992e726-e644-4d48-91ac-34eaf2964e09
CSeq: 15436 MESSAGE
Server: Asterisk PBX
Content-Length:  0

Can you try turning up Asterisk debug, eg. on CLI “core set debug 10” ?

Do you have “message_context” defined for the PJSIP endpoint or are you using just “context” ?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.