[asterisk-dev] [Code Review] 3817: res_pjsip_notify: Add the ability for PJSIPNotify AMI command and pjsip send notify CLI command to send to a URI instead of an endpoint
Jonathan Rose
reviewboard at asterisk.org
Fri Jul 18 12:22:17 CDT 2014
> On July 18, 2014, 10:40 a.m., Mark Michelson wrote:
> > /trunk/res/res_pjsip_notify.c, lines 799-801
> > <https://reviewboard.asterisk.org/r/3817/diff/2/?file=64715#file64715line799>
> >
> > The way this is set up, if you were to get on the CLI and type "pjsip notify foo ur<tab>" then the generation function will print the word "uri" twice, once for state == 0 and once for state == 1.
> >
> > To properly account for this, you need to break this up into the case where word is zero-length and where word is not zero-length.
> >
> > if (ast_strlen_zero(word)) {
> > if (state == 0) {
> > c = ast_strdup("endpoint");
> > } else if (state == 1) {
> > c = ast_strdup("uri");
> > }
> > } else if (state == 0) {
> > if (strncasecmp(word, "endpoint", wordlen) {
> > c = ast_strdup("endpoint");
> > } else if (strncasecmp(word, "uri", wordlen) {
> > c = ast_strdup("uri");
> > }
> > }
> > return c;
I tested this scenario (as well as tab completing against every substring of 'uri' and 'endpoint') against my current code and it didn't do anything unusual like print a list with multiple 'uri' options shown or tab complete to uri twice. My guess is that the generation function is already able to eliminate duplicates.
I'll go ahead and implement this though.
> On July 18, 2014, 10:40 a.m., Mark Michelson wrote:
> > /trunk/include/asterisk/res_pjsip.h, lines 1195-1203
> > <https://reviewboard.asterisk.org/r/3817/diff/2/?file=64713#file64713line1195>
> >
> > This function isn't necessary. When PJSIP is passed a URI string, PJSIP will perform URI validation for us and return an error if a badly-formed URI is passed in.
>
> Jonathan Rose wrote:
> I was absolutely getting crashes when using URIs that didn't start with 'sip:' or else were only 'sip:' without anything appended to them. I'm not sure if that will keep being the case if we use the default endpoint like suggested below, but if it does then I might need to keep this around.
After testing it with the default outbound endpoint, it was still able to cause crashes. Rats.
- Jonathan
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/3817/#review12744
-----------------------------------------------------------
On July 17, 2014, 2:27 p.m., Jonathan Rose wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/3817/
> -----------------------------------------------------------
>
> (Updated July 17, 2014, 2:27 p.m.)
>
>
> Review request for Asterisk Developers, Matt Jordan and Mark Michelson.
>
>
> Repository: Asterisk
>
>
> Description
> -------
>
> Example:
>
> Action: PJSIPNotify
> URI: sip:10.10.10.10
>
> pjsip send notify uri <type> uri <uri> [uri...]
>
>
> Adds the ability to use URIs with the PJSIP notify commands instead of endpoints. These mostly work the same as the endpoint notifications.
>
>
> Diffs
> -----
>
> /trunk/res/res_pjsip_notify.c 418783
> /trunk/res/res_pjsip.c 418783
> /trunk/include/asterisk/res_pjsip.h 418783
>
> Diff: https://reviewboard.asterisk.org/r/3817/diff/
>
>
> Testing
> -------
>
> Used existing endpoint notification and compared it to similar notifies done against URIs. The outgoing messages looked the same as far as the details I was concerned with went.
>
>
> Thanks,
>
> Jonathan Rose
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20140718/53ada128/attachment-0001.html>
More information about the asterisk-dev
mailing list