Re: [Asterisk-Users] Is a BUG ? Hints and incominglimit

2005-12-08 Thread Paradise Dove
i'm using 1.2.
get the right patch from http://bugs.digium.com/view.php?id=5281
patch fie is: Patch-5281-v2.txt


On 12/6/05, Alvaro Parres [EMAIL PROTECTED] wrote:
 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.

 I have 1.2.0


 On 12/3/05, Paradise Dove [EMAIL PROTECTED] wrote:
 
  hi,
  This is the new update_call_counter() which works fine for me:
 
  /*! \brief  update_call_counter: Handle call_limit for SIP users
  * Note: This is going to be replaced by app_groupcount
  * Thought: For realtime, we should propably update storage with inuse
  counter... */
  static int update_call_counter(struct sip_pvt *fup, int event)
  {
 char name[256];
 int *inuse, *call_limit;
 int outgoing = ast_test_flag(fup, SIP_OUTGOING);
 struct sip_user *u = NULL;
 struct sip_peer *p = NULL;
 
 if (option_debug  2)
 ast_log(LOG_DEBUG, Updating call counter for %s call\n,
  outgoing ? outgoing : incoming);
 /* Test if we need to check call limits, in order to avoid
realtime lookups if we do not need it */
 if (!ast_test_flag(fup, SIP_CALL_LIMIT))
 return 0;
 
 ast_copy_string(name, fup-username, sizeof(name));
 
 /* Check the list of users */
 // paradise dove
 p = find_peer(name, NULL, 1);
 if (p) {
 inuse = p-inUse;
 call_limit = p-call_limit;
 } else if (!u) {
 /* Try to find user */
 u = find_user(name, 1);
 if (u) {
   inuse = u-inUse;
   call_limit = u-call_limit;
 } else {
 if (option_debug  1)
 ast_log(LOG_DEBUG, %s is not a local user, no call
  limit\n, name);
 return 0;
 }
 }
 switch(event) {
 /* incoming and outgoing affects the inUse counter */
 case DEC_CALL_LIMIT:
 if ( *inuse  0 ) {
 (*inuse)--;
 } else {
 *inuse = 0;
 }
 if (option_debug  1 || sipdebug) {
 ast_log(LOG_DEBUG, Call %s %s '%s' removed from call
  limit %d\n, outgoing ? to : from, u ? user:peer
 }
 break;
 case INC_CALL_LIMIT:
 if (*call_limit  0 ) {
 if (*inuse = *call_limit) {
 ast_log(LOG_ERROR, Call %s %s '%s' rejected due
  to usage limit of %d\n, outgoing ? to : from, u ? u
 // paradise dove
 if (p)
 ASTOBJ_UNREF(p,sip_destroy_peer);
 else if (u)
 ASTOBJ_UNREF(u,sip_destroy_user);
 return -1;
 }
 }
 (*inuse)++;
 if (option_debug  1 || sipdebug) {
 ast_log(LOG_DEBUG, Call %s %s '%s' is %d out of
  %d\n, outgoing ? to : from, u ? user:peer, name, *in
 }
 break;
 default:
 ast_log(LOG_ERROR, update_call_counter(%s, %d) called
  with no event!\n, name, event);
 }
 // paradise dove
 if (p)
 ASTOBJ_UNREF(p,sip_destroy_peer);
 else if (u)
 ASTOBJ_UNREF(u,sip_destroy_user);
 return 0;
  }
 
  Paradise Dove
 
 
  On 12/2/05, Alvaro Parres [EMAIL PROTECTED] wrote:
   Could you send it patch please.
  
  
  
  
   On 11/30/05, Paradise Dove [EMAIL PROTECTED] wrote:
   
btw, i've patched this part of code and now its working fine for me.
i'm going to upload it.
   
Paradise Dove
   
On 11/30/05, Kevin Hanson [EMAIL PROTECTED] wrote:
 Paradise Dove wrote:

 Yes with version 1.2. I have tried already with call-limit and the
   same.
 
 
 i agree with you, it seems to be a bug which i've submited before
 (bug
 #5281) but it's now closed by bug marshals!
 
 
 
 It's not closed.  It's suspended waiting input from you:

 Closing until the appropriate debug/trace output can be provided.

 On 10/30 you said you were still trying to get the debug output.

 Cheers,
 Kevin
 ___
 --Bandwidth and Colocation provided by Easynews.com --

 Asterisk-Users mailing list
 To UNSUBSCRIBE or update options visit:

  
 http://lists.digium.com/mailman/listinfo/asterisk-users

___
--Bandwidth and Colocation provided by Easynews.com --
   
Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
   
  
 http://lists.digium.com/mailman/listinfo/asterisk-users
   
  
  
   ___
   --Bandwidth and Colocation provided by Easynews.com --
  
   Asterisk-Users mailing list
   To UNSUBSCRIBE or update options visit:
  
  
 http://lists.digium.com/mailman/listinfo/asterisk-users
  
  
  
  ___
  --Bandwidth 

Re: [Asterisk-Users] Is a BUG ? Hints and incominglimit

2005-12-05 Thread Alvaro Parres
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.

I have 1.2.0
On 12/3/05, Paradise Dove [EMAIL PROTECTED] wrote:
hi,This is the new update_call_counter() which works fine for me:/*! \briefupdate_call_counter: Handle call_limit for SIP users
* Note: This is going to be replaced by app_groupcount* Thought: For realtime, we should propably update storage with inusecounter... */static int update_call_counter(struct sip_pvt *fup, int event){
 char name[256]; int *inuse, *call_limit; int outgoing = ast_test_flag(fup, SIP_OUTGOING); struct sip_user *u = NULL; struct sip_peer *p = NULL; if (option_debug  2) ast_log(LOG_DEBUG, Updating call counter for %s call\n,
outgoing ? outgoing : incoming); /* Test if we need to check call limits, in order to avoidrealtime lookups if we do not need it */ if (!ast_test_flag(fup, SIP_CALL_LIMIT))
 return 0; ast_copy_string(name, fup-username, sizeof(name)); /* Check the list of users */ // paradise dove p = find_peer(name, NULL, 1); if (p) { inuse = p-inUse;
 call_limit = p-call_limit; } else if (!u) { /* Try to find user */ u = find_user(name, 1); if (u) { inuse = u-inUse; call_limit = u-call_limit;
 } else { if (option_debug  1) ast_log(LOG_DEBUG, %s is not a local user, no calllimit\n, name); return 0; } } switch(event) {
 /* incoming and outgoing affects the inUse counter */ case DEC_CALL_LIMIT: if ( *inuse  0 ) { (*inuse)--; } else { *inuse = 0; }
 if (option_debug  1 || sipdebug) { ast_log(LOG_DEBUG, Call %s %s '%s' removed from calllimit %d\n, outgoing ? to : from, u ? user:peer
 } break; case INC_CALL_LIMIT: if (*call_limit  0 ) { if (*inuse = *call_limit) { ast_log(LOG_ERROR, Call %s %s '%s' rejected due
to usage limit of %d\n, outgoing ? to : from, u ? u // paradise dove if (p) ASTOBJ_UNREF(p,sip_destroy_peer);
 else if (u) ASTOBJ_UNREF(u,sip_destroy_user); return -1; } } (*inuse)++; if (option_debug  1 || sipdebug) {
 ast_log(LOG_DEBUG, Call %s %s '%s' is %d out of%d\n, outgoing ? to : from, u ? user:peer, name, *in } break;
 default: ast_log(LOG_ERROR, update_call_counter(%s, %d) calledwith no event!\n, name, event); } // paradise dove if (p) ASTOBJ_UNREF(p,sip_destroy_peer);
 else if (u) ASTOBJ_UNREF(u,sip_destroy_user); return 0;}Paradise DoveOn 12/2/05, Alvaro Parres [EMAIL PROTECTED] wrote: Could you send it patch please.
 On 11/30/05, Paradise Dove [EMAIL PROTECTED] wrote:   btw, i've patched this part of code and now its working fine for me.
  i'm going to upload it.   Paradise Dove   On 11/30/05, Kevin Hanson [EMAIL PROTECTED] wrote:   Paradise Dove wrote:
 Yes with version 1.2. I have tried already with call-limit and the same. i agree with you, it seems to be a bug which i've submited before (bug
   #5281) but it's now closed by bug marshals!It's not closed.It's suspended waiting input from you:  
   Closing until the appropriate debug/trace output can be provided. On 10/30 you said you were still trying to get the debug output. Cheers,
   Kevin   ___   --Bandwidth and Colocation provided by Easynews.com -- Asterisk-Users mailing list
   To UNSUBSCRIBE or update options visit:   http://lists.digium.com/mailman/listinfo/asterisk-users  
  ___  --Bandwidth and Colocation provided by Easynews.com --   Asterisk-Users mailing list
  To UNSUBSCRIBE or update options visit:  http://lists.digium.com/mailman/listinfo/asterisk-users 
 ___ --Bandwidth and Colocation provided by Easynews.com -- Asterisk-Users mailing list To UNSUBSCRIBE or update options visit:
 http://lists.digium.com/mailman/listinfo/asterisk-users___
--Bandwidth and Colocation provided by Easynews.com --Asterisk-Users mailing listTo UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
___
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] Is a BUG ? Hints and incominglimit

2005-12-02 Thread Alvaro Parres
Could you send it patch please.


On 11/30/05, Paradise Dove [EMAIL PROTECTED] wrote:
btw, i've patched this part of code and now its working fine for me.i'm going to upload it.Paradise Dove
On 11/30/05, Kevin Hanson [EMAIL PROTECTED] wrote: Paradise Dove wrote: Yes with version 1.2. I have tried already with call-limit and the same.
   i agree with you, it seems to be a bug which i've submited before (bug #5281) but it's now closed by bug marshals!It's not closed.It's suspended waiting input from you:
 Closing until the appropriate debug/trace output can be provided. On 10/30 you said you were still trying to get the debug output. Cheers, Kevin ___
 --Bandwidth and Colocation provided by Easynews.com -- Asterisk-Users mailing list To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users___--Bandwidth and Colocation provided by Easynews.com --Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:http://lists.digium.com/mailman/listinfo/asterisk-users
___
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] Is a BUG ? Hints and incominglimit

2005-12-02 Thread Paradise Dove
hi,
This is the new update_call_counter() which works fine for me:

/*! \brief  update_call_counter: Handle call_limit for SIP users
 * Note: This is going to be replaced by app_groupcount
 * Thought: For realtime, we should propably update storage with inuse
counter... */
static int update_call_counter(struct sip_pvt *fup, int event)
{
char name[256];
int *inuse, *call_limit;
int outgoing = ast_test_flag(fup, SIP_OUTGOING);
struct sip_user *u = NULL;
struct sip_peer *p = NULL;

if (option_debug  2)
ast_log(LOG_DEBUG, Updating call counter for %s call\n,
outgoing ? outgoing : incoming);
/* Test if we need to check call limits, in order to avoid
   realtime lookups if we do not need it */
if (!ast_test_flag(fup, SIP_CALL_LIMIT))
return 0;

ast_copy_string(name, fup-username, sizeof(name));

/* Check the list of users */
// paradise dove
p = find_peer(name, NULL, 1);
if (p) {
inuse = p-inUse;
call_limit = p-call_limit;
} else if (!u) {
/* Try to find user */
u = find_user(name, 1);
if (u) {
  inuse = u-inUse;
  call_limit = u-call_limit;
} else {
if (option_debug  1)
ast_log(LOG_DEBUG, %s is not a local user, no call
limit\n, name);
return 0;
}
}
switch(event) {
/* incoming and outgoing affects the inUse counter */
case DEC_CALL_LIMIT:
if ( *inuse  0 ) {
(*inuse)--;
} else {
*inuse = 0;
}
if (option_debug  1 || sipdebug) {
ast_log(LOG_DEBUG, Call %s %s '%s' removed from call
limit %d\n, outgoing ? to : from, u ? user:peer
}
break;
case INC_CALL_LIMIT:
if (*call_limit  0 ) {
if (*inuse = *call_limit) {
ast_log(LOG_ERROR, Call %s %s '%s' rejected due
to usage limit of %d\n, outgoing ? to : from, u ? u
// paradise dove
if (p)
ASTOBJ_UNREF(p,sip_destroy_peer);
else if (u)
ASTOBJ_UNREF(u,sip_destroy_user);
return -1;
}
}
(*inuse)++;
if (option_debug  1 || sipdebug) {
ast_log(LOG_DEBUG, Call %s %s '%s' is %d out of
%d\n, outgoing ? to : from, u ? user:peer, name, *in
}
break;
default:
ast_log(LOG_ERROR, update_call_counter(%s, %d) called
with no event!\n, name, event);
}
// paradise dove
if (p)
ASTOBJ_UNREF(p,sip_destroy_peer);
else if (u)
ASTOBJ_UNREF(u,sip_destroy_user);
return 0;
}

Paradise Dove


On 12/2/05, Alvaro Parres [EMAIL PROTECTED] wrote:
 Could you send it patch please.




 On 11/30/05, Paradise Dove [EMAIL PROTECTED] wrote:
 
  btw, i've patched this part of code and now its working fine for me.
  i'm going to upload it.
 
  Paradise Dove
 
  On 11/30/05, Kevin Hanson [EMAIL PROTECTED] wrote:
   Paradise Dove wrote:
  
   Yes with version 1.2. I have tried already with call-limit and the
 same.
   
   
   i agree with you, it seems to be a bug which i've submited before (bug
   #5281) but it's now closed by bug marshals!
   
   
   
   It's not closed.  It's suspended waiting input from you:
  
   Closing until the appropriate debug/trace output can be provided.
  
   On 10/30 you said you were still trying to get the debug output.
  
   Cheers,
   Kevin
   ___
   --Bandwidth and Colocation provided by Easynews.com --
  
   Asterisk-Users mailing list
   To UNSUBSCRIBE or update options visit:
  
 http://lists.digium.com/mailman/listinfo/asterisk-users
  
  ___
  --Bandwidth and Colocation provided by Easynews.com --
 
  Asterisk-Users mailing list
  To UNSUBSCRIBE or update options visit:
 
 http://lists.digium.com/mailman/listinfo/asterisk-users
 


 ___
 --Bandwidth and Colocation provided by Easynews.com --

 Asterisk-Users mailing list
 To UNSUBSCRIBE or update options visit:

 http://lists.digium.com/mailman/listinfo/asterisk-users



___
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] Is a BUG ? Hints and incominglimit

2005-11-29 Thread Alvaro Parres
Yes with version 1.2. I have tried already with call-limit and the same.

On 11/28/05, Kevin Hanson [EMAIL PROTECTED] wrote:
Alvaro Parres wrote: Hi list...I have been testing the hint extension. And i detect
 that when i have in the sip.fg of the extension the incominiglimit=X (any number) the hint doesn't work all the time show the extesion as idle.If this is a bug or not ??
 Thanks.___What version of Asterisk?
1.2 deprecated incominglimit in favor ofcall-limit.Cheers,Kevin___--Bandwidth and Colocation provided by Easynews.com --
Asterisk-Users mailing listTo UNSUBSCRIBE or update options visit:http://lists.digium.com/mailman/listinfo/asterisk-users

___
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] Is a BUG ? Hints and incominglimit

2005-11-29 Thread Paradise Dove
 Yes with version 1.2. I have tried already with call-limit and the same.
i agree with you, it seems to be a bug which i've submited before (bug
#5281) but it's now closed by bug marshals!

by reading chan_sip.c u will find out that in function
update_call_counter() it first tries to update the call counter
(call-limit) prop. of user strcuture of the extension.
u = find_user(name, 1);
if (u) {
inuse = u-inUse;
call_limit = u-call_limit;
p = NULL;
} else {
/* Try to find peer */
if (!p)
p = find_peer(fup-peername, NULL, 1);
...
and then in function sip_devicestate() it changes the state of the
extension according to peer (call-limit) prop. of the extension.
if ((p = find_peer(host, NULL, 1))) {
if (p-addr.sin_addr.s_addr || p-defaddr.sin_addr.s_addr) {
/* we have an address for the peer */
/* if qualify is turned on, check the status */
if (p-maxms  (p-lastms  p-maxms)) {
res = AST_DEVICE_UNAVAILABLE;
} else {
/* qualify is not on, or the peer is responding 
properly */
/* check call limit */
if (p-call_limit  (p-inUse == 
p-call_limit))
res = AST_DEVICE_BUSY;
else if (p-call_limit  p-inUse)
res = AST_DEVICE_INUSE;
else if (p-call_limit)
res = AST_DEVICE_NOT_INUSE;
else
res = AST_DEVICE_UNKNOWN;
}

So, if your sip user is defined as friend it will be detected as user
in function update_call_counter and also detected as peer in function
sip_devicestate which doesn't sense the call-limit of friends. if
change the type of your sip user to peer you will see that hints
works fine.
another way to find this bug is to run the command sip show inuse on
CLI when some sip extensions are in a call. you will see that just the
user counter of sip friends are updated.

Paradise Dove

On 11/29/05, Alvaro Parres [EMAIL PROTECTED] wrote:


 On 11/28/05, Kevin Hanson [EMAIL PROTECTED] wrote:
  Alvaro Parres wrote:
 
   Hi list...
  
I have been testing the hint extension. And i detect
   that when i have in the sip.fg of the extension the
   incominiglimit=X (any number) the hint doesn't work all the
   time show the extesion as idle.
  
  
If this is a bug or not ??
  
   Thanks.
  
  
 
 
  
  ___
  
  
  What version of Asterisk?   1.2 deprecated incominglimit in favor of
  call-limit.
 
  Cheers,
  Kevin
  ___
  --Bandwidth and Colocation provided by Easynews.com --
 
  Asterisk-Users mailing list
  To UNSUBSCRIBE or update options visit:
 
 http://lists.digium.com/mailman/listinfo/asterisk-users
 


 ___
 --Bandwidth and Colocation provided by Easynews.com --

 Asterisk-Users mailing list
 To UNSUBSCRIBE or update options visit:

 http://lists.digium.com/mailman/listinfo/asterisk-users



___
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] Is a BUG ? Hints and incominglimit

2005-11-29 Thread Kevin Hanson

Paradise Dove wrote:


Yes with version 1.2. I have tried already with call-limit and the same.
   


i agree with you, it seems to be a bug which i've submited before (bug
#5281) but it's now closed by bug marshals!

 


It's not closed.  It's suspended waiting input from you:

Closing until the appropriate debug/trace output can be provided.

On 10/30 you said you were still trying to get the debug output.

Cheers,
Kevin
___
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] Is a BUG ? Hints and incominglimit

2005-11-29 Thread Paradise Dove
btw, i've patched this part of code and now its working fine for me.
i'm going to upload it.

Paradise Dove

On 11/30/05, Kevin Hanson [EMAIL PROTECTED] wrote:
 Paradise Dove wrote:

 Yes with version 1.2. I have tried already with call-limit and the same.
 
 
 i agree with you, it seems to be a bug which i've submited before (bug
 #5281) but it's now closed by bug marshals!
 
 
 
 It's not closed.  It's suspended waiting input from you:

 Closing until the appropriate debug/trace output can be provided.

 On 10/30 you said you were still trying to get the debug output.

 Cheers,
 Kevin
 ___
 --Bandwidth and Colocation provided by Easynews.com --

 Asterisk-Users mailing list
 To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users

___
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


[Asterisk-Users] Is a BUG ? Hints and incominglimit

2005-11-28 Thread Alvaro Parres
Hi list...

 I have been testing the hint extension. And i detect
that when i have in the sip.cfg of the extension the
incominiglimit=X (any number) the hint doesn't work all the
time show the extesion as idle.


 If this is a bug or not ??

Thanks.


___
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] Is a BUG ? Hints and incominglimit

2005-11-28 Thread Kevin Hanson

Alvaro Parres wrote:


Hi list...

 I have been testing the hint extension. And i detect
that when i have in the sip.cfg of the extension the
incominiglimit=X (any number) the hint doesn't work all the
time show the extesion as idle.


 If this is a bug or not ??

Thanks.




___
 

What version of Asterisk?  1.2 deprecated incominglimit in favor of 
call-limit.


Cheers,
Kevin
___
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users