Re: [Asterisk-Users] Multiple Registers

2006-05-17 Thread Dinesh Nair


On 05/17/06 04:00 Noah Miller said the following:

only one registration.  You can register from multiple devices, but
only the one that has most recently registered will receive calls.
Put another way, when the second device registers it will unregister
the first device.


exactly as you've put it for incoming calls. however, in practice, both 
devices will be able to make outgoing calls.


--
Regards,   /\_/\   All dogs go to heaven.
[EMAIL PROTECTED](0 0)http://www.alphaque.com/
+==oOO--(_)--OOo==+
| for a in past present future; do|
|   for b in clients employers associates relatives neighbours pets; do   |
|   echo The opinions here in no way reflect the opinions of my $a $b.  |
| done; done  |
+=+
___
--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] Multiple Registers

2006-05-16 Thread William Piper
List,

Does anyone know how to limit the amount of registrations that a sip user
can have?

For example, I have 2 softphones that I use on my laptop  desktop, both use
the same username  password. If I have both softphones up at the same time,
I can make simultaneous calls with each of them. 

I know you can have call-limit=1 but in this case, I want to allow them to
have 3 way calling but only from one sip device.

I remember seeing a posting about this on the list before but I can't find
it now.

Thanks,

bp

___
--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] Multiple Registers

2006-05-16 Thread Noah Miller

Hi bp -


Does anyone know how to limit the amount of registrations that a sip user
can have?

For example, I have 2 softphones that I use on my laptop  desktop, both use
the same username  password. If I have both softphones up at the same time,
I can make simultaneous calls with each of them.

I know you can have call-limit=1 but in this case, I want to allow them to
have 3 way calling but only from one sip device.


Are you using SER or some other SIP proxy or an experimental branch of
the sip code?  Unless something has changed recently (and it may have
as Olle has really been working on new SIP stuff), a SIP user can have
only one registration.  You can register from multiple devices, but
only the one that has most recently registered will receive calls.
Put another way, when the second device registers it will unregister
the first device.

If it fits in with your plans you may want to give the softphones
different SIP usernames, and just have the dialplan ring them at the
same extension.  E.G:

exten = 100,1,Dial(SIP/FIRST-DEVICESIP/SECOND-DEVICE)

- Noah
___
--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] Multiple Registers

2006-05-16 Thread Chen Fan
-- Forwarded message --From: Rafael Vidal Aroca [EMAIL PROTECTED]Date: May 2, 2006 5:24 AM
Subject: Re: [asterisk-dev] new featureTo: Asterisk Developers Mailing List asterisk-dev@lists.digium.com No, it is not on cvs. You should copy and add it to your asterisk.
If needed, i have patches for the 1.26--Rafael Vidal Aroca3WT - Wireless Web World Tech[EMAIL PROTECTED]Tel/Fax: +55 16 3371-7761Cel: +55 16 8126-8014
陈帆 wrote: hi,Radael.. This code have add to CVS ? thanks... On 3/5/06, *Rafael Vidal Aroca* 
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote:Hi guys,some days ago i was asking in this list how we could avoid 2 users
 from simultaneosly connecting. Well, after some discussion, i decided to implement a general solution, that shouldwork for other problems too.The idea is to execute an exeternal program every time a user
 registers or unregisters, so we can setup scripts to insert data in databases, or take some actions.I made it for IAX2, but will implement that for SIP too, if needed.
An working example is:Configure iax.conf- In the section [general] add a parameterexec=/tmp/script.shThen, create the /tmp/script.sh
#!/bin/sh#Sun Mar5 09:56:53 BRT 2006#Rafael Aroca [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
#Test script executed by asterisk on registering and unregistering peersecho [`date`] Received from asterisk parameters $*  /tmp/output
Apply the patch, compile, copy the new channel_iax2.so, and run asterisk.Everytime asterisk receives an IAX2 message of REGISTER or a clients gets UNREGISTERED, /tmp/output receives a new line. My output now
 after some tests is: [EMAIL PROTECTED]:/home/rafael/voip# cat /tmp/output [Sun Mar5 11:03:43 BRT 2006] Received from asterisk parameters register 2005 [Sun Mar5 11:03:51 BRT 2006] Received from asterisk parameters
 unregister 2004 [Sun Mar5 11:44:14 BRT 2006] Received from asterisk parameters register 2005 [Sun Mar5 11:44:40 BRT 2006] Received from asterisk parameters register 2005
 [Sun Mar5 11:45:14 BRT 2006] Received from asterisk parameters register 2005 [Sun Mar5 11:45:40 BRT 2006] Received from asterisk parameters register 2005 [Sun Mar5 11:46:14 BRT 2006] Received from asterisk parameters
 register 2005 [Sun Mar5 11:47:24 BRT 2006] Received from asterisk parameters unregister 2005Based on that, we can connect to database, or do some other
 interesting actions.The patch for this feature follows attached. By the way, would it be possible (if my code is safe and verified by someone else) to add this
 to asterisk SVN? thanks [] Rafael. --- asterisk-1.2.4/channels/chan_iax2.c 2006-01-19 23:00:
 46.0 -0200 +++ asterisk-1.2.4-tmp/channels/chan_iax2.c 2006-03-05 10:55:58.0 -0300 @@ -145,6 +145,7 @@ static char language[MAX_LANGUAGE] = ;
 static char regcontext[AST_MAX_CONTEXT] = ; +static char execOnRegister[100] = ; static int max_retries = 4; static int ping_time = 20; @@ -5552,8 +5553,31 @@
 static int expire_registry(void *data) {struct iax2_peer *p = data; + int res_fork, res_exec;ast_log(LOG_DEBUG, Expiring registration for peer '%s'\n,
 p-name); + + res_fork = fork(); + if (res_fork  0) { + ast_log(LOG_NOTICE, Could not fork); + }
 + + if (res_fork == 0) { + //Example: works fine + //res_exec = execlp(ls, ls, -la, NULL); + res_exec = execlp(execOnRegister, execOnRegister,
 unregister, p-name, NULL); + } else { + res_exec = -1; + } + + if (res_exec  0) {
 + ast_log(LOG_NOTICE, Could not exec %s, execOnRegister); + } else { + ast_log(LOG_NOTICE, Process
 spawned with PID %d, res_fork); + } + + +/* Reset the address */memset(p-addr, 0, sizeof(p-addr));
/* Reset expire notice */ @@ -5626,6 +5650,7 @@char data[80];char iabuf[INET_ADDRSTRLEN];int version; + int res_fork, res_exec;
memset(ied, 0, sizeof(ied)); @@ -5645,9 +5670,33 @@snprintf(data, sizeof(data), %s:%d:%d, ast_inet_ntoa(iabuf, sizeof(iabuf), sin-sin_addr),
 ntohs(sin-sin_port), p-expiry);if (!ast_test_flag(p, IAX_TEMPONLY)  sin-sin_addr.s_addr) {ast_db_put(IAX/Registry, p-name, data);
 + + + ast_log(LOG_NOTICE, Running %s for peer '%s'\n, execOnRegister, p-name); + + res_fork = fork();
 + if (res_fork  0) { + ast_log(LOG_NOTICE, Could not fork); + } + + if (res_fork == 0) {
 + //Example: works fine + //res_exec = execlp(ls, ls, -la, NULL); + res_exec = execlp(execOnRegister,
 execOnRegister, register, p-name, NULL); + } else { + res_exec = -1; + } +
 + if (res_exec  0) { + ast_log(LOG_NOTICE, Could not exec %s, execOnRegister); + } else {
 + ast_log(LOG_NOTICE, Process spawned with PID %d, res_fork); + } +if(option_verbose  2)
ast_verbose(VERBOSE_PREFIX_3 Registered IAX2 '%s' (%s) at %s:%d\n, p-name, ast_test_flag(iaxs[callno]-state, IAX_STATE_AUTHENTICATED) ?
 AUTHENTICATED : UNAUTHENTICATED, ast_inet_ntoa(iabuf, sizeof(iabuf), sin-sin_addr), ntohs(sin-sin_port)); +manager_event(EVENT_FLAG_SYSTEM,
 PeerStatus, Peer: IAX2/%s\r\nPeerStatus: Registered\r\n, p-name);register_peer_exten(p, 1);ast_device_state_changed(IAX2/%s,
 p-name); /* Activate notification */ @@