[Home]

Summary:ASTERISK-24601: [patch]Missing RFC4235 tags and attributes in PJSIP NOTIFY event: dialog XML body
Reporter:Marco Paland (mpaland)Labels:patch pjsip
Date Opened:2014-12-09 10:44:57.000-0600Date Closed:2021-05-19 12:16:48
Priority:MajorRegression?No
Status:Closed/CompleteComponents:pjproject/pjsip
Versions:SVN 13.1.0 13.2.0 Frequency of
Occurrence
Constant
Related
Issues:
Environment:debianAttachments:( 0) 0001-WIP.patch
( 1) 11-dialog-info.patch
( 2) 16.8-res_pjsip_dialog_info_body_generator.patch
( 3) direction_recipient.patch
( 4) extensions.conf
( 5) pjsip_dialog_info_direction.patch
( 6) pjsip.conf
( 7) res_pjsip_dialog_info_body_generator.c
Description:I'm having a similar MAJOR issue, which makes 13.0.0 unusable with snom phones.
We are using the PJSIP stack, not the chan_sip.

The NOTIFY header (at ext 1010) of a ringing extension (1005) looks like:
{code}
<--- Transmitting SIP request (808 bytes) to UDP:192.168.1.155:36578 --->
NOTIFY sip:1010@192.168.1.155:36578 SIP/2.0
Via: SIP/2.0/UDP 192.168.1.1:5060;rport;branch=z9hG4bKPjbaab25f1-9a22-4e9d-95f0-0311eba3d937
From: <sip:1005@192.168.1.1>;tag=94d2b042-dfe5-4d56-bc1b-77b212dd4d0f
To: <sip:1010@192.168.1.1>;tag=54wyd8hmq4
Contact: <sip:192.168.1.1:5060>
Call-ID: 313431373934373935333433383134-n1tmcldgl41x
CSeq: 25798 NOTIFY
Event: dialog
Subscription-State: active;expires=3500
Allow-Events: message-summary, presence, dialog, refer
Max-Forwards: 70
User-Agent: Asterisk
Content-Type: application/dialog-info+xml
Content-Length: 228

<?xml version="1.0" encoding="UTF-8"?>
<dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info" version="1" state="full" entity="sip:1005@200.200.200.200:5060">
<dialog id="1005">
 <state>early</state>
</dialog>
</dialog-info>
{code}

Issues:
- <remote> and <local> tags of the dialog are missing completely
- No (IMPORTANT) direction="recipient" attribute in <dialog> tag
- entity="sip:1005@200.200.200.200:5060" is outside IP, but inside IP (192.168.1.1) is needed

I had a short look in the actual res_pjsip_dialog_info_body_generator.c code and it seems that the first two points are missing.

In 11.9.0 with chan_sip the NOTIFY dialog body looked like:
{code}
<?xml version="1.0"?>
<dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info" version="400" state="full" entity="sip:1001@192.168.1.1">
 <dialog id="1001" call-id="pickup-313431373935383030383437363430-nfo981jwg9s8" local-tag="79zeqhuwdv" remote-tag="as6fb48de2" direction="recipient">
   <remote>
     <identity display="0174333">sip:0174333@192.168.1.1</identity>
     <target uri="sip:0174333@192.168.1.1"/>
   </remote>
   <local>
     <identity display="Counter">sip:1001@192.168.1.1</identity>
     <target uri="sip:1001@192.168.1.1"/>
   </local>
   <state>early</state>
 </dialog>
</dialog-info>
{code}
Comments:By: Rusty Newton (rnewton) 2014-12-09 14:06:53.369-0600

Marco can you attach your full pjsip.conf and at least the hints in the dialplan?

By: Marco Paland (mpaland) 2014-12-10 04:30:59.717-0600

Okay, my configs are attached, complete pjsip.conf and dialplan hints (which are trivial).

The relevant standard is RFC 4235.
Part 4.1.1 describes the optional attrs. Snom phones need the "direction" attr ("initiator" or "recipient") among other things.
Part 4.1.6 describes the <local> and <remote> tags. These could be optionally invoked in chan_sip.


By: Rusty Newton (rnewton) 2014-12-10 09:43:10.682-0600

I talked with [~jcolp] and found out that this functionality:

{quote}
Issues:

   <remote> and <local> tags of the dialog are missing completely
   No (IMPORTANT) direction="recipient" attribute in <dialog> tag
   entity="sip:1005@200.200.200.200:5060" is outside IP, but inside IP (192.168.1.1) is needed
{quote}

Is not implemented. Meaning, this is not a bug, but expected and we would consider this a feature request.

We don't handle feature requests in the tracker without a patch. Are you able to work on a patch for this functionality?

By: Marco Paland (mpaland) 2014-12-10 10:12:59.951-0600

Yes, I am - if nobody else does...
But it may take a few days to weeks to find the time.

Anyway, this is a showstopper for using pjsip with snom phones so far - except someone knows a workaround.


By: Rusty Newton (rnewton) 2015-01-08 08:14:47.781-0600

Closing out due to no activity and no patch for this feature request. Please consult with a bug marshal at irc.freenode.net #asterisk-bugs or #asterisk-dev (or E-mail asteriskteam@digium.com) to request this issue be reopened. We can reopen it if we get a patch or someone starts working on it.

By: Marco Paland (mpaland) 2015-02-07 11:06:32.340-0600

Patch to add direction "recipient"

By: Marco Paland (mpaland) 2015-02-07 11:08:56.271-0600

Added a first  single line patch which adds the direction="recipient" attr.
This is mandatory for snom phones!

By: Rusty Newton (rnewton) 2015-08-24 08:51:20.778-0500

Reopening as we now have a patch.

By: Rusty Newton (rnewton) 2015-08-24 08:53:34.606-0500

Once you've followed the Code Review process [1] and submitted your code to Gerrit [2] be sure to edit this JIRA issue and add the Gerrit review URL in the appropriate field.

Thanks!

[1] https://wiki.asterisk.org/wiki/display/AST/Code+Review
[2] https://wiki.asterisk.org/wiki/display/AST/Gerrit+Usage



By: Kilian Strickland (Scorch) 2015-11-23 03:42:18.856-0600

I have the same issue with snom phones, how do I load this .patch file?

By: Marco Paland (mpaland) 2015-11-23 07:33:56.271-0600

You apply this patch to your asterisk source, then make and install asterisk.

Unfortunately this patch is still not part of latest 13.6.0.
And this patch quite represents a MINIMAL requirement of snom phones. The desired body info is not complete.

Have a look here:
http://wiki.snom.com/Category:HowTo:Call_Pickup

Case (1) and (2) would be fine and nice to have.
My patch gives case (3) which is just the minimum.


By: Kilian Strickland (Scorch) 2015-11-26 02:47:31.531-0600

Any idea how to use this with AsteriskNOW?

By: Alexei Gradinari (alexei gradinari) 2015-12-17 15:29:52.029-0600

The same issue with Cisco SPA phones.
BLF pickup isn't working if the direction="recipient" attribute missing in 'dialog' tag.
Attached patch which add direction="recipient" only if state Ringing
Tested on asterisk 13.6.0 with Cisco SPA phones.

By: Alexei Gradinari (alexei gradinari) 2015-12-17 15:31:31.453-0600

add direction="recipient" only if state Ringing

By: Kilian Strickland (Scorch) 2016-01-05 05:12:36.935-0600

So I finally fixed it. The solution is simple but hard to find. The problem is not the Asterisk server, it was the telephone configuration. In your snom webinterface you have to choose "Extension" in the "Function Keys" site and not "BLF". But the format must the the BLF format, for example: <sip:1001@asteriskserver;user=phone>
The BLF light not blinks when the extension 1001 is currently in a call.

By: Joshua Kocinski (jakocinski) 2019-03-01 15:38:45.556-0600

What can I do to get this issue moved along?

By: Alexei Gradinari (alexei gradinari) 2019-03-01 17:13:46.891-0600

This was fixed 2 years, 11 months ago.
See https://gerrit.asterisk.org/2557

By: Goran Skular (gskular) 2019-03-01 23:34:42.969-0600

Remote and local nodes are still missing. I added local one. The problem is in remote caller information:



By: Goran Skular (gskular) 2019-03-01 23:42:44.543-0600

With hardcore's "0"
<?xml version="1.0" encoding="UTF-8"?>
<dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info" version="1" state="full" entity="sip:300@10.0.10.2:5070">
<dialog id="300" direction="recipient">
 <remote>
  <identity display="0">0</identity>
  <target uri="0" />
 </remote>
 <local>
  <identity display="300">sip:300@10.0.10.2:5070</identity>
  <target uri="sip:300@10.0.10.2:5070" />
 </local>
 <state>early</state>
</dialog>
</dialog-info>

res/res_pjsip_dialog_info_body_generator.c:

       if (!ast_strlen_zero(statestring) && !strcmp(statestring, "early")) {
               pj_xml_node *dremote, *dri, *drt, *dlocal, *dli, *dlt;
               ast_sip_presence_xml_create_attr(state_data->pool, dialog, "direction", "recipient");

               dremote = ast_sip_presence_xml_create_node(state_data->pool, dialog, "remote");
               dri = ast_sip_presence_xml_create_node(state_data->pool, dremote, "identity");    
               // don't have remote number, so it is "0" at this moment
               ast_sip_presence_xml_create_attr(state_data->pool, dri, "display", "0");
               drt = ast_sip_presence_xml_create_node(state_data->pool, dremote, "target");
               ast_sip_presence_xml_create_attr(state_data->pool, drt, "uri", "0");
               pj_strdup2(state_data->pool, &dri->content, "0");

               dlocal = ast_sip_presence_xml_create_node(state_data->pool, dialog, "local");
               dli = ast_sip_presence_xml_create_node(state_data->pool, dlocal, "identity");
               ast_sip_presence_xml_create_attr(state_data->pool, dli, "display", state_data->exten);
               dlt = ast_sip_presence_xml_create_node(state_data->pool, dlocal, "target");
               ast_sip_presence_xml_create_attr(state_data->pool, dlt, "uri", sanitized);
               pj_strdup2(state_data->pool, &dli->content, sanitized);
       }


By: Marco Styner (stynerma) 2019-04-24 03:40:04.649-0500

Is there any way to have this fixed somehow....? We are using Asterisk/FreePBX for a not-for-profit organization. The lack of the proper implementation of SIP notify makes it impossible to use a Snom phone as the "switchboard" phone in a sensible fashion (ie. it is important for us to see who is calling to another extension and to react to it).

I am just surprised that there are not many more people in need for this to work.....

We are willing to sponsor some of the work if this helps to get things moving ;-)

By: Joshua Elson (joshelson) 2019-04-24 11:28:37.410-0500

Attaching a pretty horrific hack, but it resolved this issue for us with respect to SDP remote body. Untested with Snom, but worked with a couple other manufacturers we care about.

Your mileage may vary.

By: Max Hofmann (mhofmann) 2019-05-10 04:56:43.140-0500

The patch "11-dialog-info.patch" works with Asterisk 13.21 cert 3 and snom phones. We tested with SNOM D345 an Firmware 10.1.37.11.

By: Andrew Siplas (asiplas) 2019-06-17 10:43:13.528-0500

Confirm *11-dialog-info.patch* is working with the following for Polycom VVX series (tested VVX201, VVX410, VVX500) with Asterisk GIT-master-a8e5cf5M

```
call.directedCallPickupMethod="native"
call.directedCallPickupString="**" <!-- or whatever -->
voIpProt.SIP.strictReplacesHeader="0"
attendant.behaviors.display.spontaneousCallAppearances.automata="1"
```

By: Andrew Siplas (asiplas) 2019-06-17 10:54:26.712-0500

[~joshelson] is it okay for me to upload your patch to gerrit?

By: Joshua Elson (joshelson) 2019-06-17 15:02:33.325-0500

I certainly don't mind that being uploaded [~asiplas]. It's not totally well thought out, so it might require some reworking in review, but we'd certainly like to have this as a part of trunk going forward.

By: Andrew Siplas (asiplas) 2019-06-19 19:09:56.624-0500

Cool thanks I've been looking into Polycom's [Technical Brief - Busy Lamp Field|https://community.polycom.com/polycom/attachments/polycom/VoIP/19112/1/Technical%20Brief%20-%20Busy%20Lamp%20Field.pdf] which lays a lot of their behavior and requirements out and will take a look at helping with any reworking I can; we have a few Polycom VVXs and an old Snom to confirm behavior with if need be.  (Snom also has a decent reference on what they require for certain behavior: http://wiki.snom.com/Features/Extension_Monitoring/Ringing)

What's already here enables some stuff I've seen a lot of people expect taking their VVXs from elsewhere like directed pickup or holding a user's blf to see what party is on either end (CallerID/Name, "Voicemail", etc.).

By: Paul Brooks (javauser) 2019-08-16 15:06:26.716-0500

I just upgraded my system to Asterisk 16.5.0. Whenever I upgrade, which is twice this year so far, I always build a new server image and install Asterisk using the source tarball. This time around, I applied the patch from @Joshua Elson called "11-dialog-info.patch". It fixed a problem I have had for a long time: one of my phones is a Polycom VVX401 and I could never get it to perform a directed call pickup. Now, it just works. Thank you, thank you.


By: Joseph Nadiv (yois) 2020-06-18 15:14:59.833-0500

I modified the patch submitted by @Joshua Elson to work with the changes made in 16.8.  It didn't merge for me without fixing it up, there are no real code changes to the actual patch.

By: Tim Bowyer (timbo) 2021-03-02 00:05:34.680-0600

Thanks for updating the patch @yois, will test it out.  Wondering if this issue is not getting any attention because the 'affected versions' field is populated with much older versions?
I expected this issue to get a bit more air time considering CHAN_SIP has been deprecated unless there is another tricky workaround which doesn't involve patching PJSIP.


By: Sean Bright (seanbright) 2021-03-16 11:23:56.893-0500

I've attached an [updated patch|^0001-WIP.patch] against 16 from git as of 2021-03-16.

This resolves most of the coding guideline problems from the current patch (dead code removal, builds in dev mode, removes {{//}} comments, etc).


By: Joseph Nadiv (yois) 2021-04-12 23:18:00.669-0500

@Sean Bright - Would you consider submitting this for review so it can make it to the code base? If not, do you allow your code to be submitted by someone else in this thread?

By: Sean Bright (seanbright) 2021-04-13 09:49:54.843-0500

Anyone can put my patch up for review. It is just a cleanup of patches uploaded previously by other people. I am making the assumption that once a patch has been uploaded to JIRA or Gerrit and marked as a contribution it is fair game for anyone to submit to the project.

By: Joshua C. Colp (jcolp) 2021-04-13 09:56:19.185-0500

[~seanbright] You are correct, if licensed and attributed as such in the review it's perfectly fine.

By: Ross Beer (rossbeer) 2021-04-23 04:04:47.498-0500

Would this method work for shared BLF using sources such as XMPP?

By: Friendly Automation (friendly-automation) 2021-05-19 12:16:50.690-0500

Change 15763 merged by Friendly Automation:
res_pjsip_dialog_info_body_generator: Add LOCAL/REMOTE tags in dialog-info+xml

[https://gerrit.asterisk.org/c/asterisk/+/15763|https://gerrit.asterisk.org/c/asterisk/+/15763]

By: Friendly Automation (friendly-automation) 2021-05-19 12:17:43.631-0500

Change 15821 merged by Friendly Automation:
res_pjsip_dialog_info_body_generator: Add LOCAL/REMOTE tags in dialog-info+xml

[https://gerrit.asterisk.org/c/asterisk/+/15821|https://gerrit.asterisk.org/c/asterisk/+/15821]

By: Friendly Automation (friendly-automation) 2021-05-19 12:25:02.037-0500

Change 15781 merged by Joshua Colp:
res_pjsip_dialog_info_body_generator: Add LOCAL/REMOTE tags in dialog-info+xml

[https://gerrit.asterisk.org/c/asterisk/+/15781|https://gerrit.asterisk.org/c/asterisk/+/15781]

By: Friendly Automation (friendly-automation) 2022-06-01 19:26:47.780-0500

Change 18581 merged by Friendly Automation:
res_pjsip_dialog_info_body_generator: Set LOCAL target URI as local URI

[https://gerrit.asterisk.org/c/asterisk/+/18581|https://gerrit.asterisk.org/c/asterisk/+/18581]

By: Friendly Automation (friendly-automation) 2022-06-01 19:26:51.886-0500

Change 18578 merged by Friendly Automation:
res_pjsip_dialog_info_body_generator: Set LOCAL target URI as local URI

[https://gerrit.asterisk.org/c/asterisk/+/18578|https://gerrit.asterisk.org/c/asterisk/+/18578]

By: Friendly Automation (friendly-automation) 2022-06-02 09:25:58.899-0500

Change 18583 merged by Joshua Colp:
res_pjsip_dialog_info_body_generator: Set LOCAL target URI as local URI

[https://gerrit.asterisk.org/c/asterisk/+/18583|https://gerrit.asterisk.org/c/asterisk/+/18583]

By: Friendly Automation (friendly-automation) 2022-06-02 09:26:11.753-0500

Change 18582 merged by Joshua Colp:
res_pjsip_dialog_info_body_generator: Set LOCAL target URI as local URI

[https://gerrit.asterisk.org/c/asterisk/+/18582|https://gerrit.asterisk.org/c/asterisk/+/18582]