[asterisk-dev] ast_sip_session

Matthew Jordan mjordan at digium.com
Tue Nov 15 11:40:33 CST 2016


On Tue, Nov 15, 2016 at 6:17 AM, Joshua Colp <jcolp at digium.com> wrote:

> On Mon, Nov 14, 2016, at 03:46 AM, Kelvin Chua wrote:
> > playing around chan_pjsip/res_pjsip
> >
> > i have some data i want to pass from upstream to downstream on reponse
> > for
> > example, P-Associated-URI
> >
> > i figured that datastore on ast_sip_session only handles either the
> > upstream channel or the downstream channel. I can already parse the
> > header
> > on upstream but stuck on how to write
> > this to the reply downstream. any pointers?
>
> There is no generic mechanism for doing this currently: specifically
> passing data back on a response or answer. The closest thing would be to
> add a new frame type (frame.h) to Asterisk, put data on it (in an
> ast_frame), propagate it through, and have it read/handled on the other
> side. If you end up with specific questions you can respond back with
> them, but you are sort of venturing into uncharted territory unless
> someone else has an idea on how to better do it.
>
>
I'd throw out there as well that this _may_ not be worth doing,
particularly automatically. As a B2BUA, you're always going to be fighting
against Asterisk's model of channels and bridges if you want to
automatically propagate information from an inbound channel to an outbound
channel.

Things you have to think through:
(1) What happens when there are Local channels?
(2) What happens if there are multiple outbound channels (parallel dial)?
(3) What happens if I'm in a bridge with multiple channels (conference)?
(4) If the information can be provided in a re-INVITE, what occurs if I
pass this information along before or after an answer?

One of the safer ways of handling the notion of passing things from an
inbound to an outbound channel is to have the dialplan do it. You can use
functions like PJSIP_HEADER to read values off of an inbound channel, store
them in a channel variable with inheritance, then use a pre-dial handler
with PJSIP_HEADER (or CHANNEL, etc.) to modify the outbound channel(s)
prior to dialing. Doing that gives you more control over exactly _when_ you
pass information along, and helps you avoid the many, many edge cases that
can occur.

-- 
Matthew Jordan
Digium, Inc. | CTO
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20161115/aa3bbfff/attachment.html>


More information about the asterisk-dev mailing list