[OpenSER-Users] Storing SIP Response Codes with avpops?

Christian Schlatter cs at unc.edu
Thu Nov 8 23:13:35 CET 2007


Douglas Garstang wrote:
> Daniel,
> 
> I found that I was able to do this, and openser accepts it, and inserts 
> a database record...
> avp_db_query("insert into sip_responses (response_code, response_reason) 
> values ('$rs','abc')");
> 
> That is in a failure block. However, in the failure block, $rs is 0. I 
> tried putting the avp_db_query into the reply block, and openser tells 
> me that avp_db_query isn't allowed in the reply block, SO I then tried 
> putting this:
> 
> avp_write("$rs","$avp(result)");
> 
> into the reply block, and openser tells me that avp_write can't be used 
> in a reply block.
> 
> Argh!

You'd have to patch the openser source code in order to write avps in 
the reply route. Since version 1.2, there is a TM parameter for that:

modparam("tm", "onreply_avp_mode", 1)

as described in

http://www.openser.org/docs/modules/1.3.x/tm.html#AEN304


/Christian

> 
> I just want to get a sip response code for the call and put it into the 
> database.
> 
> I'm using version 1.1.
> 
> Douglas.
> 
> 
> ----- Original Message ----
> From: Daniel-Constantin Mierla <daniel at voice-system.ro>
> To: Douglas Garstang <dougmig33 at yahoo.com>
> Cc: users at lists.openser.org
> Sent: Thursday, November 8, 2007 1:30:50 PM
> Subject: Re: [OpenSER-Users] Storing SIP Response Codes with avpops?
> 
> What version are you using? I just tested with trunk version and all ok?
> 
> For the other issue, just set:
> modparam("avpops", "avp_table", "usr_preferences")
> 
> Daniel
> 
> 
> On 11/08/07 23:20, Douglas Garstang wrote:
>  > Thanks, but when I try that, I get the following error from openser:
>  >
>  > Nov  7 23:17:32 localhost openser[7035]: ERROR:xl_parse_spec: bad pvar
>  > name "rr{s.escape.common})') "
>  > Nov  7 23:17:32 localhost openser[7035]:
>  > ERROR:avpops:fixup_db_query_avp: wrong format[insert into
>  > sip_responses (response_code, response_reason) values ('$rs',
>  > '$(rr{s.escape.common})') ]
>  > Nov  7 23:17:32 localhost openser[7035]: ERROR: fix_actions: fixing
>  > failed (code=-1) at cfg line 139
>  >
>  > OpenSER also complains that i need to specify an avp table, but since
>  > I am specifying the table in the query, I don't understand why that's
>  > required.
>  >
>  > Douglas.
>  >
>  >
>  > ----- Original Message ----
>  > From: Daniel-Constantin Mierla <daniel at voice-system.ro 
> <mailto:daniel at voice-system.ro>>
>  > To: Douglas Garstang <dougmig33 at yahoo.com <mailto:dougmig33 at yahoo.com>>
>  > Cc: users at lists.openser.org <mailto:users at lists.openser.org>
>  > Sent: Thursday, November 8, 2007 11:57:35 AM
>  > Subject: Re: [OpenSER-Users] Storing SIP Response Codes with avpops?
>  >
>  > Hello,
>  >
>  > On 11/08/07 21:40, Douglas Garstang wrote:
>  > > All,
>  > >
>  > > I'd like to store SIP response codes in mysql using avpops. Is this
>  > > possible?
>  > >
>  > > I tried to do this a few years ago and couldn't find any
>  > > documentation. Unfortunately, I still can't find any.
>  > >
>  > > Can someone post an example? All I can find online is reference
>  > > documentation for avpops.
>  > >
>  > > I'd really like to see a full example with the modparams defining the
>  > > table structure, and how I would use avp_write and avp_db_store to
>  > > write the $rr response code.
>  > the easiest way is to use avp_db_query(), you can give as parameter any
>  > sql query. In your case, you can use in onreply_route:
>  >
>  > avp_db_query("insert into sip_responses (response_code, response_reason)
>  > values ('$rs', '$(rr{s.escape.common})') ");
>  >
>  > You need to create the table sip_responses, with the two string columns.
>  >
>  > Daniel
>  >
>  > >
>  > > Thanks.
>  > > Douglas.
>  > >
>  > >
>  > > __________________________________________________
>  > > Do You Yahoo!?
>  > > Tired of spam? Yahoo! Mail has the best spam protection around
>  > > http://mail.yahoo.com
>  > > 
> ------------------------------------------------------------------------
>  > >
>  > > _______________________________________________
>  > > Users mailing list
>  > > Users at lists.openser.org <mailto:Users at lists.openser.org> 
> <mailto:Users at lists.openser.org <mailto:Users at lists.openser.org>>
>  > > http://lists.openser.org/cgi-bin/mailman/listinfo/users
>  > >
>  >
>  >
>  > __________________________________________________
>  > Do You Yahoo!?
>  > Tired of spam? Yahoo! Mail has the best spam protection around
>  > http://mail.yahoo.com
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Users mailing list
> Users at lists.openser.org
> http://lists.openser.org/cgi-bin/mailman/listinfo/users





More information about the Users mailing list