[asterisk-bugs] [JIRA] (ASTERISK-13145) [patch] Presence subscription on Cisco SIP phone needs special Cisco-styled XML

John Bayly (JIRA) noreply at issues.asterisk.org
Fri Oct 10 11:49:39 CDT 2014


    [ https://issues.asterisk.org/jira/browse/ASTERISK-13145?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=222985#comment-222985 ] 

John Bayly commented on ASTERISK-13145:
---------------------------------------

Stuart an Gareth - many thanks for your help. Once I modified sip_custom_post.conf the BLF worked perfectly.

However, the patched version introduced a bug when I execute the an Originate command from AsteriskManager when specifying the CallerID - the server segfaults. I had initially thought that it was due to a bug I introduced while modifying the patch to work with  11.13.0-1.shmz65.1.31 (patched by FreePBX), but while I was looking into it I found what I believe is the cause.

I believe the "offending" code is this
{code:title=gareth-11.12.0.patch}
@@ -12403,12 +12702,9 @@
        }
        connected_id = ast_channel_connected_effective_id(p->owner);
        lid_num = S_COR(connected_id.number.valid, connected_id.number.str, NULL);
-       if (!lid_num) {
-               return 0;
-       }
        lid_name = S_COR(connected_id.name.valid, connected_id.name.str, NULL);
-       if (!lid_name) {
-               lid_name = lid_num;
+       if (!lid_num && !lid_name) {
+               return 0;
        }
        lid_pres = ast_party_id_presentation(&connected_id);

{code}

The patched hunk of code not doesn't return if either lid_num or _lid_name are null. I've changed the test to an *||* instead of *&&*, so if either strings are invalid it returns. I've installed and tested this and my originate commands no longer segfault, which is nice! So my version is the following

{code:title=gareth-11.12.0_jb.patch}
@@ -12403,12 +12702,9 @@
        }
        connected_id = ast_channel_connected_effective_id(p->owner);
        lid_num = S_COR(connected_id.number.valid, connected_id.number.str, NULL);
-       if (!lid_num) {
-               return 0;
-       }
        lid_name = S_COR(connected_id.name.valid, connected_id.name.str, NULL);
-       if (!lid_name) {
-               lid_name = lid_num;
+       if (!lid_num || !lid_name) {
+               return 0;
        }
        lid_pres = ast_party_id_presentation(&connected_id);

{code}


Can you verify that what I've done is valid - C/C++ isn't my really language of choice.

For reference, this is the bash command I've been using to test originate:
{code}
echo "Channel: SIP/1000
MaxRetries: 1
WaitTime: 30
Context: from-internal
Extension: 326        
Priority: 1
CallerID: 1000" > /var/spool/asterisk/outgoing/dialout.txt
{code}

> [patch] Presence subscription on Cisco SIP phone needs special Cisco-styled XML
> -------------------------------------------------------------------------------
>
>                 Key: ASTERISK-13145
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-13145
>             Project: Asterisk
>          Issue Type: New Feature
>          Components: Channels/chan_sip/NewFeature
>            Reporter: David McNett
>         Attachments: 01-btias.patch, 02-media-attrib-sdp.patch, 03-media-attrib-sdp-backport.patch, 04-imageattr.patch, 7965.xml, 8001 to 8003 and hangup.pcap, 8001 to 8003 and pickup then talk then hangup.pcap, asterisk-1.8.7.0-chan_sip.patch, backtrace.txt, Capture - CSO Presence - Lift and Replace Handset.pcap, Capture - CSO Presence - Ring between 2 monitored extensions.pcap, chan_sip.c_available_on-the-phone.patch, chan_sip.c_blf_available_on-the-phone.patch, chan_sip.c.patch, cisco-blf-asterisk.1.6.0.26.patch, cisco-blf-asterisk.1.6.2.13.patch, cisco-blf-asterisk.1.8.0.patch, core-ast115-sccp.tar.gz, gareth-10.6.0.patch, gareth-11.12.0.patch, gareth-11.2.1-dndbusy.patch, gareth-1.8.14.0.patch, gareth-documentation-url.txt, gareth-featurepolicy.xml, gareth-mk-1.8.13.0.patch, gareth-softkeys.xml, gareth-softkeys.xml, memleak_astdb.patch, messages-1, Poly_reboot.log, rjw-11.4.0.patch, second-sip-trace-7941-9-1-1SR1.txt, sip-trace-7941-9-1-1SR1.txt, trace2.txt
>
>
> Cisco phones appear to be unable to parse the existing PIDF XML being generated by Asterisk for presence notification.  I've attached a patch which produces well-formed (but incomplete) XML which will satisfy a Cisco phone.  The patch as supplied will successfully render a "busy" subscription, but does not send a subsequent "available" notification, so presence detection only half works currently.
> I suspect the next step might be to watch some CallManager SIP traffic to identify precisely what XML tags the phone is expecting in order to properly parse an available subscription, but I'm not in a position to do that.  I'll continue to work with this, though, and perhaps may be able to stumble upon the precise data the Cisco phone is looking for.
> {{****** ADDITIONAL INFORMATION ******}}
> I believe that this requires the Cisco phones be configured to use SIP TCP when connecting to Asterisk.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list