[asterisk-users] single registration per user

Dave Platt dplatt at radagast.org
Mon Sep 19 19:01:41 CDT 2011


> Is about outgoing calls from multiple devices with the same username at
> aprox same time. The overwritten is for incomming calls. I want to prevent
> using the same account in multiple devices at same time. The solution with
> IP will not apply because users may be behind nat or will change everytime
> multiple access points. Do you have any other clues?

As others have noted, this doesn't really have anything to do with
"registration" per se.

Registration by a user, tells where calls *to* that user should be
sent (IP address and port).

Authorization to initiate an outbound call through Asterisk doesn't
depend on the device having registered.  It depends on the device
sending an INVITE with the appropriate user-ID, and the device's
ability to respond to the corresponding security challenge from
Asterisk.  Any device having the appropriate ID and secret can
thus authenticate on the outbound call... Asterisk won't (unless
you jump through a lot of hoops) "know" whether this is the same
device that has currently registered with that ID.

I can think of several approaches which might work:

(1) Set "call-limit=1" in the SIP user definition for this user.
    This will (if I'm reading the documentation correctly) limit
    Asterisk to only one call to this user/peer at a time.  There
    used to be separate limits for "incoming" and "outgoing" calls,
    but that was eliminated several versions ago.

(2) As others have suggested, do it in the dialplan using the GROUP
    function.  Perhaps the simplest way to do this would be to
    set up a dialplan context which each of these users is bound to.
    In its "s" ruleset, set the GROUP() value to be the user-ID, and
    then check the number of members in the group... if it's more than
    1, jump to a rule which does a Congestion() or plays a "You are
    a cheater and I make rude motions in your direction" recorded message
    or hangs up or ...

    If the group-count test succeeds, jump to another dialing context
    which actually does the dialing based on the $EXTEN passed by the
    caller.

    This would be a bit like example 2 in the page at
    http://www.voip-info.org/wiki/view/Asterisk+func+group but you
    would use a specific group name per user e.g. $CHANNEL(peername)
    rather than a group per outbound trunk.

(3) Do something like (2), but instead of using the GROUP feature to
    limit calls, compare the caller's IP address with the IP address
    currently registered by the calling user e.g. compare
    $CHANNEL(peerip) with $SIPPEER($CHANNEL(peername),ip).

    This wouldn't be as robust as approach (2) - there would probably be
    moments when a second device could make a call - and so I don't really
    encourage it.





More information about the asterisk-users mailing list