Hi Juan<br>Its not a horrible solution, actually we are using both, Opensips and Asterisk (with a2billing AGI) in a heavy production environment for pre/post wholesale billing and I can control almost everything from a2billing admin interface.<br>
<br>Try this procedure:<br><br>You can use a mysql VIEW for 'opensips subscriber table' from 'a2billing user table' to facilitate opensips users provisioning from a2billing admin/user web interfaces.<br><br>
For example, Sip proxy Opensips IP: 192.1689.12.254<br>DB: 192.168.1.29<br>A2billing DB: a2billing<br>A2billing subscriber table: cc_card<br><br>In mysql console:<br><br>USE opensips;<br><br>CREATE VIEW opensips.subscriber_v1 AS <br>
SELECT id AS id, <br>useralias AS username, <br>'192.168.12.254' AS domain, <br>userpass AS password, <br>email AS email_address, <br>md5(concat(useralias,' : ','192.168.12.254',' : ',userpass)) AS ha1, <br>
md5(concat(useralias,'@','192.168.12.254',' : ','192.168.12.254',' : ',userpass)) AS ha1b, <br>useralias AS rpid from a2billing.cc_card WHERE tariff=2;<br><br>INSERT INTO version (table_name,table_version) VALUES ('subscriber_v1','6');<br>
<br><br>Then in your opensips config file note that you have to indicate the new table 'subscriber_v1' as follows:<br><br>.<br>.<br>.<br># Tablas 'uri' y tabla 'subscriber' <br>loadmodule "uri_db.so"<br>
modparam("uri_db", "db_url", "mysql://opensips:******@<a href="http://192.168.1.29/opensips">192.168.1.29/opensips</a>")<br>modparam("uri_db", "db_table", "subscriber_v1")<br>
.<br>...<br>########################################################################<br># Request route 'base-route-REGISTER'<br>########################################################################<br>route[2]<br>
{<br> sl_send_reply("100", "Trying");<br> if(!www_authorize("", "subscriber_v1")) <br> # Nota: tabla 'subscriber_v1' es un VIEW de mya2billing.cc_card<br> {<br> # xlog("L_INFO", "Register authentication failed - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci UA=$ua \n");<br>
xlog("L_INFO", "Register authentication failed - F=$fu IP=$si UA=$ua \n");<br> www_challenge("", "0");<br> exit;<br> }<br> if(!check_to()) ...<br>.<br>.<br>
.<br>#########################################################################<br># Request route 'base-route-INVITE'<br>#########################################################################<br>route[4]<br>{<br>
log(1," route[4]---> INVITE Message Handler \n");<br> sl_send_reply("100", "Trying");<br> if(from_gw()) ## verifica si la llamada viene de alguno de los GWs, tabla 'lcr'<br>
{<br> xlog("L_INFO", "Call from PSTN - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");<br> setflag(23);<br> }<br> else<br> {<br> if(allow_trusted()) ## Si la llamada no viene del GW, verifica si el ip de origen esta en la tabla 'trusted'<br>
{<br> xlog("L_INFO", "Call from trusted peer - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");<br> if(!is_domain_local("$rd"))<br> {<br> xlog("L_INFO", "Rejecting peering attempt with non-local request domain - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");<br>
sl_send_reply("403", "Relaying Denied");<br> exit;<br> }<br> setflag(23);<br> }<br> else ## => Si no viene del GW o de algun UA en 'trusted' entonces la llamada se origina en el sip server y debe autenticarse:<br>
{<br> if(!proxy_authorize("", "subscriber_v1")) <br> {<br> xlog("L_INFO", "Proxy authentication failed - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci UA=$ua \n\n");<br>
proxy_challenge("", "0");<br> exit;<br> }<br> if(!check_from())<br>.<br>.<br>.<br><br>Good luck!<br>Rafael<br><br>PS: I also want to know why some people think its a horrible solution... I think its the best.<br>
<br><br><div class="gmail_quote">On Tue, Feb 10, 2009 at 10:21 AM, Juan Asencio <span dir="ltr"><<a href="mailto:juan@asencio.dk">juan@asencio.dk</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Raúl and list,<br>
<br>
Could anyone explain a little bit, why the OpenSIPS+Asterisk+A2Billing<br>
would be a horrible solution?<br>
<br>
I'm new at this and I would like to learn and understand what kind of<br>
problems could arise from such a solution.<br>
<br>
Regards,<br>
<font color="#888888"><br>
Juan.-<br>
</font><div><div></div><div class="Wj3C7c"><br>
> El Lunes, 9 de Febrero de 2009 18:41, Gonzalo Gonzalez escribió:<br>
>> May be I am not explaining myself right, but read this post:<br>
>><br>
>> <a href="http://forum.asterisk2billing.org/viewtopic.php?t=2456" target="_blank">http://forum.asterisk2billing.org/viewtopic.php?t=2456</a><br>
>><br>
>> I know people use the same database using database views.<br>
>><br>
>> Thanks,<br>
>><br>
>> Gonzalo<br>
><br>
> Please, reply to the list, not to me directly.<br>
><br>
> Talking about the issue .. that thread only said that you could use the<br>
> same<br>
> DB throught views to have the same users on OpenSIPS and on Asterisk,<br>
> anything more.<br>
><br>
> You could not do accounting/billing only with OpenSIPS and A2Billing,<br>
> that's<br>
> what I told you, you need OpenSIPS+Asterisk+A2Billing and IHMO that's a<br>
> horrible solution, with lot of problems on you future.<br>
><br>
> Regards<br>
> --<br>
> Raúl Alexis Betancor Santana<br>
> Dimensión Virtual<br>
><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>
<br>
<br>
<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>
</div></div></blockquote></div><br>