Hello Bogdan,<br><br>I appreciate a lot your response regarding my inquiry. I've been reading that tutorial as well as the AVPops and dialog modules documentation for about a month now. I tried to adapt that route block for inbound calls and here's a portion of what I have on our OpenSIPS 1.5 config file:<br>
<br>-------------------------------------------------------------------------------<br>modparam("dialog", "dlg_flag", 4)<br>modparam("dialog", "profiles_with_value", "inbound")<br>
<br>......<br><br> } else if (uri=~"sip:1234567890@.*") {<br> route(3);<br> rewritehost("111.222.111.222");<br><br>.......<br><br>route[3]<br>
{<br> ## have we done our checking on this call?<br> if(!isflagset(31))<br> {<br> # user has max channel limit set as preference<br> if(is_avp_set("$avp(s:channels)/n") && avp_check("$avp(s:channels)", "gt/i:0"))<br>
{<br> # get the current calls for DID<br> get_profile_size("inbound","$tU","$var(calls)");<br><br> # check within limit<br>
if($avp(s:channels) > $var(calls))<br> {<br> xlog("L_INFO", "Call control: DID '$tU' currently has<br> '$var(calls)' of '$avp(s:channels)' active calls before this one\n");<br>
$var(setprofile) = 1;<br> }<br> else<br> {<br> xlog("L_INFO", "Call control: DID '$tU' channel limit exceeded [$var(calls)/$avp(s:channels)]<br>
\n");<br> send_reply("487", "Request Terminated: Channel limit exceeded\n");<br> exit;<br> }<br> }<br>
else<br> {<br> $var(setprofile) = 0;<br> }<br><br> call_control();<br><br> switch ($retcode)<br> {<br> case 2:<br>
# Call with no limit<br> case 1:<br> # Call with a limit under callcontrol management (either prepaid or postpaid)<br> break;<br>
case -1:<br> # Not enough credit (prepaid call)<br> xlog("L_INFO", "Call control: not enough credit for prepaid call\n");<br>
acc_rad_request("402");<br> sl_send_reply("402", "Not enough credit");<br> exit;<br> break;<br>
case -2:<br> # Locked by call in progress (prepaid call)<br> xlog("L_INFO", "Call control: prepaid call locked by another call in progress\n");<br>
acc_rad_request("403");<br> sl_send_reply("403", "Call locked by another call in progress");<br> exit;<br>
break;<br> default:<br> # Internal error (message parsing, communication, ...)<br> xlog("L_INFO", "Call control: internal server error\n");<br>
acc_rad_request("500");<br> sl_send_reply("500", "Internal server error");<br> exit;<br> }<br>
<br> if($var(setprofile) > 0)<br> {<br> create_dialog();<br> set_dlg_profile("inbound","$tU");<br> }<br><br>
## mark checking done<br> setflag(31);<br> }<br>}<br><br>----------------------------------------------------------------<br><br>And here are the logs appearing on /var/log/messages:<br>
<br>Jan 6 05:53:22 opensips cdrtool[20998]: MaxSessionTime Duration=36000 CallId=<a href="mailto:28a35ce1-4d7a175-25a58684@124.123.234.229">28a35ce1-4d7a175-25a58684@124.123.234.229</a> From=si<br><a href="mailto:p%3A12135551234@124.123.234.229">p:12135551234@124.123.234.229</a> Gateway=124.123.234.229 To=sip:1234567890@124.123.234.241:5060;user=phone<br>
Jan 6 05:53:22 opensips cdrtool[20998]: MaxSessionTime=unlimited Type=postpaid CallId=<a href="mailto:28a35ce1-4d7a175-25a58684@124.123.234.229">28a35ce1-4d7a175-25a58684@124.123.234.229</a> BillingParty=<a href="mailto:12135551234@124.123.234.229">12135551234@124.123.234.229</a><br>
Jan 6 05:53:22 opensips call-control[21263]: Call id <a href="mailto:28a35ce1-4d7a175-25a58684@64.77.234.229">28a35ce1-4d7a175-25a58684@64.77.234.229</a> of <a href="mailto:12135551234@124.123.234.229">12135551234@124.123.234.229</a> to<br>
sip:1234567890@124.123.234.241:5060;user=phone is postpaid not limited<br>Jan 6 05:53:22 opensips /usr/local/sbin/opensips[1636]: new branch at sip:1234567890@111.222.111.222:5060;user=phone<br>Jan 6 05:53:22 opensips /usr/local/sbin/opensips[1640]: incoming reply<br>
Jan 6 05:53:22 opensips /usr/local/sbin/opensips[1636]: incoming reply<br>Jan 6 05:53:22 opensips /usr/local/sbin/opensips[1636]: ACC: transaction answered: timestamp=1262786002;method=INVITE;from_t<br>ag=14fe61da-25a58684-e5ea4d40;to_tag=as6a53f46c;call_id=<a href="mailto:28a35ce1-4d7a175-25a58684@64.77.234.229">28a35ce1-4d7a175-25a58684@64.77.234.229</a>;code=200;reason=OK<br>
Jan 6 05:53:22 opensips /usr/local/sbin/opensips[1637]: Recive call variable : <null> <null><br><br>As for the channels limit value, do I have to define it on usr_preferences table? I have these records on the said table:<br>
<br>mysql> select * from usr_preferences;<br>+----+------+------------+--------+---------------+------+------------+---------------------+<br>| id | uuid | username | domain | attribute | type | value | last_modified |<br>
+----+------+------------+--------+---------------+------+------------+---------------------+<br>| 1 | | 1234567890 | | channels | 0 | 3 | 1900-01-01 00:00:01 |<br>| 2 | | 0 | | called_number | 0 | 12135551234 | 1900-01-01 00:00:01 |<br>
+----+------+------------+--------+---------------+------+------------+---------------------+<br>2 rows in set (0.00 sec)<br><br>Unfortunately, I'm not quite sure on what section or portion of opensips.cfg file I will have to put the loading of user preferences to the AVPs. Any inputs or suggestions will be greatly appreciated?<br>
<br>Thank you very much.<br><br>--conpaj--<br><br><br><div class="gmail_quote">On Wed, Jan 6, 2010 at 11:26 PM, Bogdan-Andrei Iancu <span dir="ltr"><<a href="mailto:bogdan@voice-system.ro">bogdan@voice-system.ro</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 Johnson,<br>
<br>
The idea is to use dialog profiles to keep trace of the ongoing calls<br>
(per resource). As a first step take a look at the following tutorial:<br>
<br>
<a href="http://www.opensips.org/Resources/DocsTutConcurrentCalls" target="_blank">http://www.opensips.org/Resources/DocsTutConcurrentCalls</a><br>
<br>
Regards,<br>
Bogdan<br>
<div><div></div><div class="h5"><br>
Johnson Pajayat wrote:<br>
> Hi!<br>
><br>
> I'm a newbie with OpenSIPS administration and configuration and I<br>
> searched on the mail archives regarding limiting the channels but only<br>
> found the site regarding "Concurrent calls limitation". I've been<br>
> trying to grasp the whole idea about AVPops and dialog module but<br>
> unfortunately I'm having a hard time understanding it. If ever, does<br>
> anyone here be kind enough to point me to any available documents or<br>
> sample configurations file that will help me limit the channels on<br>
> inbound calls to a single or group of DIDs? Implementation will be<br>
> done static first and hopefully once I got the whole idea, will be<br>
> implementing a dynamic one.<br>
><br>
> Thank you very much.<br>
><br>
> --conpaj--<br>
><br>
</div></div>> ------------------------------------------------------------------------<br>
<div class="im">><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>
</div><font color="#888888">--<br>
Bogdan-Andrei Iancu<br>
<a href="http://www.voice-system.ro" target="_blank">www.voice-system.ro</a><br>
</font><div><div></div><div class="h5"><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>