Here is another example or two.<div><br></div><div>Set module parameter to grab an extra column (tag) in a dbaliases table:</div><div>modparam(&quot;avpops&quot;, &quot;db_scheme&quot;, &quot;alias_scheme:table=dbaliases;username_col=username;domain_col=domain;value_col=tag;value_type=string&quot;)</div>
<div><br></div><div>In the config use the alias scheme (send in the uri of the RURI and store in avp 120):</div><div>avp_db_load( &quot;$ru/uri&quot;, &quot;$avp(120)/$alias_scheme&quot; );</div><div><br></div><div>Assuming the tag column contains the customer class, use it to load values from the (default) usr_preferences table:</div>
<div>avp_db_load(&quot;$avp(120)&quot;, &quot;a&quot;);</div><div><br></div><div>You can also load avp values based on various headers.  Use request user from RURI:</div><div>avp_db_load(&quot;$ru&quot;, &quot;a&quot;);</div>
<div><br></div><div>The first form will look for rows in usr_preferences where the uuid column match what is contained in avp 120.  The second form will look for rows in which the username and domain columns match the username and domain of the RURI.  If the domain is looked at is a module parameter.  The avp&#39;s that get set are the  attribute column and the value the avp is set to is the value column.</div>
<div><br></div><div>Here are a couple rows from the usr_preferences table:</div><div><br></div><div>| id | uuid | username     | domain               | attribute          | type | value                       | last_modified       |</div>
<div><br></div><div>| 37 | 2000 |              |                      | no-nat-support     |    0 | Y                           | 0000-00-00 00:00:00 |</div><div><br></div><div>| 28 |      | 9194397461   | <a href="http://trunking.bsltech.net">trunking.bsltech.net</a> | userdebug          |    0 | Y                           | 2010-08-25 00:00:00 |</div>
<div><br></div><div>And finally, use those values:</div><div><br></div><div><div>        if( is_avp_set(&quot;$avp(userdebug)/s&quot;) )</div><div>        {</div><div>                xlog(&quot;L_INFO&quot;, &quot;Turning on debug in inbound call due to user prefs flag for call $ci from $fU \n&quot;);</div>
<div>                setflag(1);</div><div>        }</div></div><div><br></div><div><div>        if( !is_avp_set(&quot;$avp(no-nat-support)/s&quot;) )</div><div>        {</div><div>                bm_start_timer(&quot;media_proxy_benchmark&quot;); #keep track of how long it&#39;s taking to talk to relays</div>
<div>                engage_media_proxy();</div></div><div>                more interesting stuff....</div><div>        }</div><div><br></div><div><br></div><div>Richard</div><div><br></div><div><br><div class="gmail_quote">
On Mon, May 28, 2012 at 2:23 PM, Ali Pey <span dir="ltr">&lt;<a href="mailto:alipey@gmail.com" target="_blank">alipey@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
avp_db_query(&quot;insert into SIP_REG(TIMESTAMP, SIP_USERNAME, DOMAIN, AGENT, CONTACT, EXPIRES, SOURCE, NET_TYPE, SERVER) values (&#39;CURRENT_TIMESTAMP&#39;, &#39;$fU&#39;, &#39;$fd&#39;, &#39;$ua&#39;, &#39;$ct&#39;, &#39;$hdr(Expires)&#39;, &#39;$avp(i:42)&#39;, &#39;NATED&#39;, &#39;Primary OpenSIPS&#39; )&quot;);<div>

<br></div><div>Regards,</div><div>Ali<br><br><div class="gmail_quote"><div><div class="h5">On Sun, May 27, 2012 at 3:07 AM, prasad kelkar <span dir="ltr">&lt;<a href="mailto:durga144@gmail.com" target="_blank">durga144@gmail.com</a>&gt;</span> wrote:<br>

</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">hello,<br>I tried using AVPpops module to connect to table in mysql.<br>I cant acces value<br>
Please give me example code.<br>
Thank You<br>
<br></div></div>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
<br></blockquote></div><br></div>
<br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
<br></blockquote></div><br></div>