[asterisk-dev] [Code Review] 3780: res_pjsip_outbound_publish / res_pjsip_publish_asterisk: Add outbound PUBLISH support with 'asterisk' event type.
Joshua Colp
reviewboard at asterisk.org
Mon Jul 21 10:36:35 CDT 2014
> On July 17, 2014, 9:49 p.m., Mark Michelson wrote:
> > /trunk/res/res_pjsip_outbound_publish.c, lines 71-75
> > <https://reviewboard.asterisk.org/r/3780/diff/1/?file=63302#file63302line71>
> >
> > This seems like an odd default behavior. I would suspect that by default we would actually magic up a From URI of our own based instead of telling the server that the message is coming from itself.
> >
> > Doing this when no to_uri is provided makes good sense though.
>
> Joshua Colp wrote:
> It's a PJSIPism, and it actually makes sense (imo). In the case of PUBLISH you are publishing information about yourself usually. It makes sense that it should be coming from you.
>
> Mark Michelson wrote:
> Hm, now I'm a bit confused about terminology being used. Who is the "server" in the server_uri? The XML docs say "SIP URI of the server and entity to publish to" . So in other words, it's the URI of the destination of the PUBLISH request. So let's say the Asterisk server that sends the PUBLISH is Alice, and the Asterisk server that receives the PUBLISH is Bob. You set server_uri=bob at example.com and do not set a from_uri or to_uri. Our SIP request would look something like:
>
> PUBLISH sip:bob at example.com
> To: sip:bob at example.com
> From: sip:bob at example.com;tag=blahblahblah
>
> That's what's intended? Alice is publishing information about Alice, not Bob. If the From header is supposed to indicate the source of the publication, I'd expect that the From would give some indication that the publication is from Alice.
>
> Joshua Colp wrote:
> The name of the entity you are publishing to is generally yourself. I am Alice and I am publishing the state of Alice. This is speaking from a SIP perspective. You'd use server_uri=sip:alice at example.com. This only differs if you are publishing to an entity which is different than your own. I am Alice but I'm publishing the state of Bob.
>
> server_uri=sip:bob at example.com
> from_uri=sip:alice at example.com
>
> Mark Michelson wrote:
> Ah, so the server URI is in essence the URI of the resource whose state is being published. It's not the URI of the UAS that is to receive the PUBLISH request. If that's the case, then is the to_uri used to populate the RURI of the PUBLISH request?
>
> Joshua Colp wrote:
> It just controls the To URI.
>
> server_uri = Target URI (including user for request URI and the location of where to send it)
> to_uri = URI in To header
> from_uri = URI in From header
>
> Mark Michelson wrote:
> Okay, now I think I understand. I think you were focusing more on username, and I was focusing more on location in this conversation. So if Alice is a server and is located at foo.com, and Bob is a second server and is located at bar.com, then when Alice sends a publication to Bob, the server URI would be something like:
>
> server_uri = alice at bar.com
>
> Right? That way, the message gets routed to Bob's server, but the resource represented in the user part is alice.
CORRECT!
- Joshua
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/3780/#review12723
-----------------------------------------------------------
On July 21, 2014, 12:14 p.m., Joshua Colp wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/3780/
> -----------------------------------------------------------
>
> (Updated July 21, 2014, 12:14 p.m.)
>
>
> Review request for Asterisk Developers.
>
>
> Repository: Asterisk
>
>
> Description
> -------
>
> This adds two PJSIP modules which add outbound PUBLISH support and an 'asterisk' event type.
>
> The res_pjsip_outbound_publish module is a common module which provides basic logic for setting up outbound PUBLISH clients, handling authentication requests, handling configuration, and lifetime. Extra modules implement specific event types which are registered with res_pjsip_outbound_publish. Since it takes care of configuration when an outbound PUBLISH is configured extra configuration can be passed to the event type implementation to further configure itself.
>
> The res_pjsip_publish_asterisk module implements inbound and outbound support for an 'asterisk' event type. This event type conveys device and mailbox state between Asterisk instances using a JSON content body. As internal device or mailbox state changes the module sends a PUBLISH message to other configured instances. When a PUBLISH is received the contents are examined and a device or mailbox state change queued up within Asterisk. To restrict what is sent and received filtering is available using regular expressions which can reduce SIP traffic.
>
> A wiki page is available at https://wiki.asterisk.org/wiki/display/~jcolp/Exchanging+Device+and+Mailbox+State+Using+PJSIP which has some configuration details with some examples. This should also be reviewed.
>
>
> Diffs
> -----
>
> /trunk/res/res_pjsip_pubsub.exports.in 419075
> /trunk/res/res_pjsip_pubsub.c 419075
> /trunk/res/res_pjsip_publish_asterisk.c PRE-CREATION
> /trunk/res/res_pjsip_outbound_publish.exports.in PRE-CREATION
> /trunk/res/res_pjsip_outbound_publish.c PRE-CREATION
> /trunk/include/asterisk/res_pjsip_pubsub.h 419075
> /trunk/include/asterisk/res_pjsip_outbound_publish.h PRE-CREATION
>
> Diff: https://reviewboard.asterisk.org/r/3780/diff/
>
>
> Testing
> -------
>
> Set up two Asterisk instances, configured both sides to publish to eachother, made calls and manipulated voicemail. Watched PUBLISH messages go between them and state change.
>
>
> Thanks,
>
> Joshua Colp
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20140721/0dec9639/attachment-0001.html>
More information about the asterisk-dev
mailing list