<div>which version of Asterisk do you have ?, Becouse when i change the function to your code, every time that one phone with call-limit the Asterisk crash.</div>
<div> </div>
<div>I have 1.2.0<br><br> </div>
<div><span class="gmail_quote">On 12/3/05, <b class="gmail_sendername">Paradise Dove</b> <<a href="mailto:pardove@gmail.com">pardove@gmail.com</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">hi,<br>This is the new update_call_counter() which works fine for me:<br><br>/*! \brief update_call_counter: Handle call_limit for SIP users
<br>* Note: This is going to be replaced by app_groupcount<br>* Thought: For realtime, we should propably update storage with inuse<br>counter... */<br>static int update_call_counter(struct sip_pvt *fup, int event)<br>{<br>
char name[256];<br> int *inuse, *call_limit;<br> int outgoing = ast_test_flag(fup, SIP_OUTGOING);<br> struct sip_user *u = NULL;<br> struct sip_peer *p = NULL;<br><br> if (option_debug > 2)<br> ast_log(LOG_DEBUG, "Updating call counter for %s call\n",
<br>outgoing ? "outgoing" : "incoming");<br> /* Test if we need to check call limits, in order to avoid<br> realtime lookups if we do not need it */<br> if (!ast_test_flag(fup, SIP_CALL_LIMIT))
<br> return 0;<br><br> ast_copy_string(name, fup->username, sizeof(name));<br><br> /* Check the list of users */<br> // paradise dove<br> p = find_peer(name, NULL, 1);<br> if (p) {<br> inuse = &p->inUse;
<br> call_limit = &p->call_limit;<br> } else if (!u) {<br> /* Try to find user */<br> u = find_user(name, 1);<br> if (u) {<br> inuse = &u->inUse;<br> call_limit = &u->call_limit;
<br> } else {<br> if (option_debug > 1)<br> ast_log(LOG_DEBUG, "%s is not a local user, no call<br>limit\n", name);<br> return 0;<br> }<br> }<br> switch(event) {
<br> /* incoming and outgoing affects the inUse counter */<br> case DEC_CALL_LIMIT:<br> if ( *inuse > 0 ) {<br> (*inuse)--;<br> } else {<br> *inuse = 0;<br> }
<br> if (option_debug > 1 || sipdebug) {<br> ast_log(LOG_DEBUG, "Call %s %s '%s' removed from call<br>limit %d\n", outgoing ? "to" : "from", u ? "user":"peer"
<br> }<br> break;<br> case INC_CALL_LIMIT:<br> if (*call_limit > 0 ) {<br> if (*inuse >= *call_limit) {<br> ast_log(LOG_ERROR, "Call %s %s '%s' rejected due
<br>to usage limit of %d\n", outgoing ? "to" : "from", u ? "u<br> // paradise dove<br> if (p)<br> ASTOBJ_UNREF(p,sip_destroy_peer);<br>
else if (u)<br> ASTOBJ_UNREF(u,sip_destroy_user);<br> return -1;<br> }<br> }<br> (*inuse)++;<br> if (option_debug > 1 || sipdebug) {
<br> ast_log(LOG_DEBUG, "Call %s %s '%s' is %d out of<br>%d\n", outgoing ? "to" : "from", u ? "user":"peer", name, *in<br> }<br> break;<br>
default:<br> ast_log(LOG_ERROR, "update_call_counter(%s, %d) called<br>with no event!\n", name, event);<br> }<br> // paradise dove<br> if (p)<br> ASTOBJ_UNREF(p,sip_destroy_peer);<br>
else if (u)<br> ASTOBJ_UNREF(u,sip_destroy_user);<br> return 0;<br>}<br><br>Paradise Dove<br><br><br>On 12/2/05, Alvaro Parres <<a href="mailto:aparres@gmail.com">aparres@gmail.com</a>> wrote:<br>> Could you send it patch please.
<br>><br>><br>><br>><br>> On 11/30/05, Paradise Dove <<a href="mailto:pardove@gmail.com">pardove@gmail.com</a>> wrote:<br>> ><br>> > btw, i've patched this part of code and now its working fine for me.
<br>> > i'm going to upload it.<br>> ><br>> > Paradise Dove<br>> ><br>> > On 11/30/05, Kevin Hanson <<a href="mailto:tuxpert@comcast.net">tuxpert@comcast.net</a>> wrote:<br>> > > Paradise Dove wrote:
<br>> > ><br>> > > >>Yes with version 1.2. I have tried already with call-limit and the<br>> same.<br>> > > >><br>> > > >><br>> > > >i agree with you, it seems to be a bug which i've submited before (bug
<br>> > > >#5281) but it's now closed by bug marshals!!!!!<br>> > > ><br>> > > ><br>> > > ><br>> > > It's not closed. It's suspended waiting input from you:<br>> > >
<br>> > > "Closing until the appropriate debug/trace output can be provided."<br>> > ><br>> > > On 10/30 you said you were still trying to get the debug output.<br>> > ><br>> > > Cheers,
<br>> > > Kevin<br>> > > _______________________________________________<br>> > > --Bandwidth and Colocation provided by <a href="http://Easynews.com">Easynews.com</a> --<br>> > ><br>> > > Asterisk-Users mailing list
<br>> > > To UNSUBSCRIBE or update options visit:<br>> > ><br>> <a href="http://lists.digium.com/mailman/listinfo/asterisk-users">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br>> > >
<br>> > _______________________________________________<br>> > --Bandwidth and Colocation provided by <a href="http://Easynews.com">Easynews.com</a> --<br>> ><br>> > Asterisk-Users mailing list<br>
> > To UNSUBSCRIBE or update options visit:<br>> ><br>> <a href="http://lists.digium.com/mailman/listinfo/asterisk-users">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br>> ><br>><br>
><br>> _______________________________________________<br>> --Bandwidth and Colocation provided by <a href="http://Easynews.com">Easynews.com</a> --<br>><br>> Asterisk-Users mailing list<br>> To UNSUBSCRIBE or update options visit:
<br>><br>> <a href="http://lists.digium.com/mailman/listinfo/asterisk-users">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br>><br>><br>><br>_______________________________________________<br>
--Bandwidth and Colocation provided by <a href="http://Easynews.com">Easynews.com</a> --<br><br>Asterisk-Users mailing list<br>To UNSUBSCRIBE or update options visit:<br> <a href="http://lists.digium.com/mailman/listinfo/asterisk-users">
http://lists.digium.com/mailman/listinfo/asterisk-users</a><br></blockquote></div><br>