[asterisk-users] func SHARED, how to use?

Philipp von Klitzing klitzing at pool.informatik.rwth-aachen.de
Thu Sep 23 07:06:57 CDT 2010


Hi!

> > And the third hit in my google result is this:
> >
> > http://lists.digium.com/pipermail/asterisk-users/2009-July/235288.html
> >
> > Since I mentioned in my previous message that you will find the answer
> > in the archive of this list you could have found that even without
> > google. gmane.org for example has a nice web UI for reading this list.
   > 
> I'm sorry, but this is absolutely the same thing I see on voip-info.org.

Indeed, I added that info to the Wiki yesterday to make it easier for you 
in case you would not succed with Google.

> And, I'm too stupid to understand how to use it in dial plan, especially
> for RTCP statistics. :-( May be this is very-very simple, so nobody
> understand what I want, if it is absolutely clear... But,could someone
> provide me example of how to use SHARED with RTCP?

Since you are not describing a concrete problem in detail (and illustrate 
that with some code) it is difficult to help you. For example you still 
do not tell us if the Zap/DAHDI channel is your first or second call leg, 
and you do not tell us which data you would like to access, and how it is 
failing in your current implementation.

Anyway, usage of SHARED _is_ very simple: In the Macro that is called 
with the M option of the Dial() statement you add a one-line statement of 
the type

  Set(SHARED(foo,SIP/123)=456)

- foo is the variable name that you choose
- 456 is the data you are interested in (e.g. the codec chosen)
- SIP/123 might be your Zap/DAHDI channel, which you could pass onto the 
second call leg either by a channel variable prefixed with an underscore 
(like _MYVAR), or by adding it as a Macro argument.

As a result you will be able to use 

   ${SHARED(foo,SIP/123)} 

in the h extension of your first call leg.

Note: RTCP data are only available for SIP channels, not for Zap/DADHI 
channels or other channel technologies. Information about the negotiated 
codec is not part of the RTCP data.

Philipp




More information about the asterisk-users mailing list