I want OpenSer to dinamically look for alias in a table for each domain, so I've in my database tables with name as:
dbaliases_sip1_domain_org dbaliases_sip2_domain_com dbaliases_sip3_domain_net
And I do (thanks to Andreas Granig):
$avp(s:dom) = $rd; avp_subst("$avp(s:dom)", "/./_/g"); alias_db_lookup("dbaliases_" + $avp(s:dominio));
but it fails because the SQL query is literally:
select username,domain from dbaliases_$avp(s:dominio) where ...
I've tryed putting variables and more things into the function parameter, but it's never processed and the SQL query is always done literally. I use OpenSer 1.2.1.
What can I do for solving this? Thanks.
Hello,
if the alias translates in a single SIP user, it is easy to do it with avp_db_query() of avpops module. You load the result in avps and then push it to R-URI.
Cheers, Daniel
On 08/02/07 19:03, Iñaki Baz Castillo wrote:
I want OpenSer to dinamically look for alias in a table for each domain, so I've in my database tables with name as:
dbaliases_sip1_domain_org dbaliases_sip2_domain_com dbaliases_sip3_domain_net
And I do (thanks to Andreas Granig):
$avp(s:dom) = $rd; avp_subst("$avp(s:dom)", "/./_/g"); alias_db_lookup("dbaliases_" + $avp(s:dominio));
but it fails because the SQL query is literally:
select username,domain from dbaliases_$avp(s:dominio) where ...
I've tryed putting variables and more things into the function parameter, but it's never processed and the SQL query is always done literally. I use OpenSer 1.2.1.
What can I do for solving this? Thanks.
El Thursday 02 August 2007 18:07:32 Daniel-Constantin Mierla escribió:
Hello,
if the alias translates in a single SIP user, it is easy to do it with avp_db_query() of avpops module. You load the result in avps and then push it to R-URI.
Ok, I'll try that.
Anyway I would like to do a suggestion: functions documentation could tell if they allow variable processing into their parameters. Some allow it and some others not, but there is not a way to know that.
Regards and thanks.
Cheers, Daniel
On 08/02/07 19:03, Iñaki Baz Castillo wrote:
I want OpenSer to dinamically look for alias in a table for each domain, so I've in my database tables with name as:
dbaliases_sip1_domain_org dbaliases_sip2_domain_com dbaliases_sip3_domain_net
And I do (thanks to Andreas Granig):
$avp(s:dom) = $rd; avp_subst("$avp(s:dom)", "/./_/g"); alias_db_lookup("dbaliases_" + $avp(s:dominio));
but it fails because the SQL query is literally:
select username,domain from dbaliases_$avp(s:dominio) where ...
I've tryed putting variables and more things into the function parameter, but it's never processed and the SQL query is always done literally. I use OpenSer 1.2.1.
What can I do for solving this? Thanks.
On 08/02/07 19:15, Iñaki Baz Castillo wrote:
El Thursday 02 August 2007 18:07:32 Daniel-Constantin Mierla escribió:
Hello,
if the alias translates in a single SIP user, it is easy to do it with avp_db_query() of avpops module. You load the result in avps and then push it to R-URI.
Ok, I'll try that.
Anyway I would like to do a suggestion: functions documentation could tell if they allow variable processing into their parameters. Some allow it and some others not, but there is not a way to know that.
those that support pseudo-variables, are explicitly saying it, as far as I know. The others, dont. PV came later, and when support for them was added, the docs were updated. But for the other functions, nobody updated to say that they do not support PV.
Daniel
Regards and thanks.
Cheers, Daniel
On 08/02/07 19:03, Iñaki Baz Castillo wrote:
I want OpenSer to dinamically look for alias in a table for each domain, so I've in my database tables with name as:
dbaliases_sip1_domain_org dbaliases_sip2_domain_com dbaliases_sip3_domain_net
And I do (thanks to Andreas Granig):
$avp(s:dom) = $rd; avp_subst("$avp(s:dom)", "/./_/g"); alias_db_lookup("dbaliases_" + $avp(s:dominio));
but it fails because the SQL query is literally:
select username,domain from dbaliases_$avp(s:dominio) where ...
I've tryed putting variables and more things into the function parameter, but it's never processed and the SQL query is always done literally. I use OpenSer 1.2.1.
What can I do for solving this? Thanks.
El Thursday 02 August 2007 18:15:58 Iñaki Baz Castillo escribió:
El Thursday 02 August 2007 18:07:32 Daniel-Constantin Mierla escribió:
Hello,
if the alias translates in a single SIP user, it is easy to do it with avp_db_query() of avpops module. You load the result in avps and then push it to R-URI.
Ok, I'll try that.
Thanks, it works perfectly and I tell how it's finally:
$avp(s:dominio) = $rd; avp_subst("$avp(s:dominio)", "/./_/g"); avp_db_query("select username,domain from dbaliases_$avp(s:dominio) where alias_username='$rU' AND alias_domain='$rd'", "$avp(s:alias_username); $avp(s:alias_domain)"); avp_pushto("$ru/username","$avp(s:alias_username)"); avp_pushto("$ru/domain","$avp(s:alias_domain)");
:)
On 08/02/07 19:34, Iñaki Baz Castillo wrote:
El Thursday 02 August 2007 18:15:58 Iñaki Baz Castillo escribió:
El Thursday 02 August 2007 18:07:32 Daniel-Constantin Mierla escribió:
Hello,
if the alias translates in a single SIP user, it is easy to do it with avp_db_query() of avpops module. You load the result in avps and then push it to R-URI.
Ok, I'll try that.
Thanks, it works perfectly and I tell how it's finally:
great, next is a beautification for 1.2.x:
$avp(s:dominio) = $rd; avp_subst("$avp(s:dominio)", "/./_/g"); avp_db_query("select username,domain from dbaliases_$avp(s:dominio) where alias_username='$rU' AND alias_domain='$rd'", "$avp(s:alias_username); $avp(s:alias_domain)");
$ru = "sip:"+$avp(s:alias_username)+"@"+$avp(s:alias_domain);
and remove next two.
Daniel
avp_pushto("$ru/username","$avp(s:alias_username)"); avp_pushto("$ru/domain","$avp(s:alias_domain)");
:)
El Thursday 02 August 2007 18:44:01 Daniel-Constantin Mierla escribió:
On 08/02/07 19:34, Iñaki Baz Castillo wrote:
El Thursday 02 August 2007 18:15:58 Iñaki Baz Castillo escribió:
El Thursday 02 August 2007 18:07:32 Daniel-Constantin Mierla escribió:
Hello,
if the alias translates in a single SIP user, it is easy to do it with avp_db_query() of avpops module. You load the result in avps and then push it to R-URI.
Ok, I'll try that.
Thanks, it works perfectly and I tell how it's finally:
great, next is a beautification for 1.2.x:
$avp(s:dominio) = $rd; avp_subst("$avp(s:dominio)", "/./_/g"); avp_db_query("select username,domain from dbaliases_$avp(s:dominio) where alias_username='$rU' AND alias_domain='$rd'", "$avp(s:alias_username); $avp(s:alias_domain)");
$ru = "sip:"+$avp(s:alias_username)+"@"+$avp(s:alias_domain);
and remove next two.
Ok, I was already thinking about it, but what about if the protocolo is sips ? Note that you are forcing "sip", couldn't it cause problems using sips?
Thanks for all.
On 08/03/07 10:41, Iñaki Baz Castillo wrote:
El Thursday 02 August 2007 18:44:01 Daniel-Constantin Mierla escribió:
On 08/02/07 19:34, Iñaki Baz Castillo wrote:
El Thursday 02 August 2007 18:15:58 Iñaki Baz Castillo escribió:
El Thursday 02 August 2007 18:07:32 Daniel-Constantin Mierla escribió:
Hello,
if the alias translates in a single SIP user, it is easy to do it with avp_db_query() of avpops module. You load the result in avps and then push it to R-URI.
Ok, I'll try that.
Thanks, it works perfectly and I tell how it's finally:
great, next is a beautification for 1.2.x:
$avp(s:dominio) = $rd; avp_subst("$avp(s:dominio)", "/./_/g"); avp_db_query("select username,domain from dbaliases_$avp(s:dominio) where alias_username='$rU' AND alias_domain='$rd'", "$avp(s:alias_username); $avp(s:alias_domain)");
$ru = "sip:"+$avp(s:alias_username)+"@"+$avp(s:alias_domain);
and remove next two.
Ok, I was already thinking about it, but what about if the protocolo is sips ? Note that you are forcing "sip", couldn't it cause problems using sips?
$rU = $avp(s:alias_username); $rd = $avp(s:alias_domain);
Daniel
Thanks for all.