[asterisk-dev] chan_sip.c: how to get phone source and destination

Fadil Sutomo fsutomo at gmail.com
Tue Jul 31 14:36:49 CDT 2007


Hi Kevin,

In app_dial.c, yes I can easily access the "database_location" by invoking
pbx_builtin_getvar_helper(chan, "database_location"), however I still run to
another problem.

I notice that pbx_builtin_getvar_helper only works for the "calling"
(source) party NOT for the "called" (destination).

Say, I have this in sip.conf

[Xlite1]
...
setvar=database_location=/home/fadil/MySQL
...

[GrandStream]
...
setvar=database_location=/opt/some_database
...


If I call from Xlite1 to Grandstream (source = Xlite1 and
destination=Grandstream), then we know in app_dial.c, the source channel is
"in" and the destination channel is "c" in function "wait_for_answer".

Then, pbx_builtin_getvar_helper(in, "database_location") returns
"/home/fadil/MySQL" BUT pbx_builtin_getvar_helper(c, "database_location")
returns (null).

Could you (or anyone reading this post) please tell me why this is happening
and how to solve it..

Thank You
Fadil



On 7/31/07, Fadil Sutomo <fsutomo at gmail.com> wrote:
>
> AMAZING!!!!!!!!
>
> Thank you so much...
>
> On 7/30/07, Kevin P. Fleming <kpfleming at digium.com> wrote:
> >
> > Fadil Sutomo wrote:
> >
> > > In order to use this field, then each client has to use this field
> > > through sip.conf.
> > > For example:
> > > [Xlite]
> > > username=Fadil
> > > secret=fadil
> > > ..
> > > ..
> > > database_location=/home/fadil/MySQL
> > >
> > > I modify chan_sip in order to do this.
> > >
> > > Now, what I want to do is to access this location "on-the-fly", that
> > is
> > > accessing this field while the phone is answered. And I am doing this
> > in
> > > app_dial.c.
> > >
> > > Now my question: is there any way from app_dial.c to access the field
> > > that I created in chan_sip.c (database_location) ?
> >
> > It would do you good to read the sample config files and documentation;
> > this functionality is already available. Change that line to:
> >
> > setvar=database_location=/home/fadil/MySQL
> >
> > and you will magically have a variable called 'DATABASE_LOCATION' in the
> > dialplan (and elsewhere) with that value in it.
> >
> > --
> > Kevin P. Fleming
> > Director of Software Technologies
> > Digium, Inc. - "The Genuine Asterisk Experience" (TM)
> >
> > _______________________________________________
> > --Bandwidth and Colocation Provided by http://www.api-digital.com--
> >
> > asterisk-dev mailing list
> > To UNSUBSCRIBE or update options visit:
> >    http://lists.digium.com/mailman/listinfo/asterisk-dev
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-dev/attachments/20070731/364b9839/attachment.htm 


More information about the asterisk-dev mailing list