Out-of-dialog messages returning 481 error

I’ve set up a snom phone to generate a SIP MESSAGE when pressing one of the buttons, but it doesn’t seem to enter the dialplan. The endpoint message_context is set and I’ve created the appropriate extensions in it, but they never get called. The pjsip debug output looks like this:

<--- Received SIP request (768 bytes) from UDP:10.3.0.123:5060 --->
MESSAGE sip:727@asterisk SIP/2.0
Via: SIP/2.0/UDP 10.3.0.123:5060;branch=z9hG4bK-1pct5pn06cv6;rport
From: "Mark" <sip:727@asterisk.ad.protectchildren.ca>;tag=j7xp7id0js
To: <sip:1@asterisk>;tag=uip68oc5q1
Call-ID: d2c1a6652bd0-5bawxjpa1nl3
CSeq: 1 MESSAGE
Max-Forwards: 70
User-Agent: snomD717/10.1.159.12
Authorization: Digest username="727",realm="asterisk",nonce="1705503748/9560784f65fab81fe9bb17e0baf66cf5" (...)
Content-Type: application/x-buttons
Content-Length: 67

k=1
a=message
t=<urn:uuid:8017f6f7-9ab7-4da2-8411-000413BE5871>

<--- Transmitting SIP response (395 bytes) to UDP:10.3.0.123:5060 --->
SIP/2.0 481 Call/Transaction Does Not Exist
Via: SIP/2.0/UDP 10.3.0.123:5060;rport=5060;received=10.3.0.123;branch=z9hG4bK-1pct5pn06cv6
Call-ID: d2c1a6652bd0-5bawxjpa1nl3
From: "Mark" <sip:727@asterisk.ad.protectchildren.ca>;tag=j7xp7id0js
To: <sip:1@asterisk.ad.protectchildren.ca>;tag=uip68oc5q1
CSeq: 1 MESSAGE
Server: Asterisk PBX certified/16.8-cert13
Content-Length:  0

I enabled pjsip debugging and found that the 481 is being generated within the SIP UA layer:

DEBUG[1328061]: pjproject: <?>: 	        sip_ua_layer.c .Unable to find dialogset for Request msg MESSAGE/cseq=1 (rdata0x7ffeec023958), answering with 481

I realize application/x-buttons will be rejected within res_pjsip_messaging, but in that case I would expect to get a 415 Unsupported Media Type - I don’t think it’s making it that far. I set some breakpoints in res_pjsip_messaging.c but its module_on_rx_request function never seems to be called. It’s like the SIP UA is handling and rejecting the message, so it never gets to the messaging-specific code. Am I misunderstanding how the SIP MESSAGE support works? Is the message from the phone invalid?

It’s rejecting the MESSAGE because it does appear to be in-dialog. It’s got both From and To tags.

Ohh, I think I get it - I hadn’t realized the importance of the tags. The phone is sending To: <sip:1@asterisk>;tag=uip68oc5q1, but it should be sending To: <sip:1@asterisk> . The phone should only be assigning a From tag and leaving it up to the server (or peer) to generate the To tag. Since the phone applies its own random To tag, it’s indicating that the message is associated with some dialog that doesn’t actually exist.

I don’t see anything in the Snom configuration to change this behaviour, so I’ll have to try something other than SIP messages for the button actions. Thanks for your help!

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