[Serusers] Database queries?

sip sip at arcdiv.com
Tue Sep 27 14:12:57 CEST 2005


I've actually been unable to get avp_print() to do... well... anything. 
Debugging messages have completely eluded me, even with the debugging level
boosted.  The only additional logging I get is a death message for each and
every subprocess on server restart when I boost debugging up. 

I am, perhaps, missing a nuance somewhere. :)

N.

On Tue, 27 Sep 2005 14:54:35 +0300, Bogdan-Andrei Iancu wrote
> try avp_print() to see the value of loaded AVPs; also increase debug 
> level - you will get the compared values as debug.
> 
> regards,
> bogdan
> 
> sip wrote:
> 
> >Daniel,
> >
> >I've tried that as well.  If I replace the entry in the database with
> >sip:motherinlaw at another.domain.com, then I still have the problem that using 
> >
> >if(avp_check("$urire", "eq/$from/i"))
> >
> >doesn't match, but using
> >
> >if(avp_check("$urire", "eq/sip:motherinlaw at another.domain.com/i"))
> >
> >does match. Seems to be picking up the DB entry and will match it if I
> >statically enter what it's supposed to match, but not against a $from
> >variable. I was trying to figure out how to get debug messages to print so I
> >could see what was going on, but I have as yet been unsuccessful. 
> >
> >
> >N.
> >
> >On Tue, 27 Sep 2005 13:50:56 +0300, Daniel-Constantin Mierla wrote
> >  
> >
> >>Hello,
> >>
> >>the content of $from is sip:motherinlaw at another.domain.com
> >>
> >>$from is a sip uri, that's why does not match when do the check.
> >>
> >>Daniel
> >>
> >>On 09/26/05 22:09, sip wrote:
> >>
> >>    
> >>
> >>>I'm attempting to figure out how to use AVPops to grab data from the
> >>>calls_forwarding database table so I can avoid having to write my own module
> >>>to handle that sort of thing, and I can avoid doing what I'm CURRENTLY doing
> >>>which is using a pretty hideous exec_msg SQL query hack. 
> >>>
> >>>I've run into a snag that I can't figure a way around.... 
> >>>
> >>>In the calls_forwarding table, I have these fields used in this fashion:
> >>>username == username
> >>>domain == domain
> >>>uri_re == username at domain information (for use in a couple of ways)
> >>>purpose == purpose for this entry (callblock, callfwd, screening, etc)
> >>>action == action to take (for callblock, could be reply or relay, etc)
> >>>param1 == option for the action above
> >>>param2 == additional option
> >>>
> >>>So... if I have a call block entry, it would be like this:
> >>>
> >>>username = bob
> >>>domain = mydomain.com
> >>>uri_re = motherinlaw at another.domain.com
> >>>purpose = callblock
> >>>action = reply
> >>>param1 = 486
> >>>param2 = "Busy"
> >>>
> >>>The logic would be along the lines of, when a call comes in for
> >>>bob at mydomain.com, I check to see if he has any callblock entries. If so, I
> >>>check those to see if any match the From user. If there's a match, take the
> >>>action in action (in this case reply with 486 - Busy... could be relay to
> >>>voicemail, etc). 
> >>>
> >>>The problem I'm having is in the grabbing of all the data from the DB and
> >>>comparing it to the right values. For instance, with this avpops query
> >>>
> >>>
> >>>avp_db_load("$ruri/username", "$urire/$urire_scheme");
> >>># Load the urire column for this and check to see if
> >>># it matches the $from address
> >>>if(avp_check("$urire", "eq/$from/I"))
> >>>{
> >>> send reply... take action... etc.
> >>>}
> >>>
> >>>I'm calling from the number motherinlaw at another.domain.com.  If I use the
> >>>above, the avp_check test fails.  If I put  
> >>>
> >>>if(avp_check("$urire", "eq/motherinlaw at another.domain.com/I"))
> >>>{
> >>> send reply... take action... etc.
> >>>}
> >>>
> >>>
> >>>Then the test succeeds and the appropriate action is taken. 
> >>>
> >>>Any guesses as to what I'm missing here... why the test is failing when I use
> >>>the $from variable for AVPops, but not when I hard-code the $from address
into
> >>>the test (which implies to me that it's grabbing the right data from the
> >>>database, but there's an issue in either the $from variable or the comparison
> >>>statement)? 
> >>>
> >>>I'd love a little shove in the right direction. I thought about writing a
> >>>module that returned what I need without the need for complex logical paths,
> >>>but my C is pretty rusty, and I'm trying to save myself the hair-pulling. :)
> >>>
> >>>
> >>>N.
> >>>
> >>>_______________________________________________
> >>>Serusers mailing list
> >>>serusers at lists.iptel.org
> >>>http://lists.iptel.org/mailman/listinfo/serusers
> >>>
> >>> 
> >>>
> >>>      
> >>>
> >
> >_______________________________________________
> >Serusers mailing list
> >serusers at lists.iptel.org
> >http://lists.iptel.org/mailman/listinfo/serusers
> >
> >  
> >




More information about the sr-users mailing list