Some solutions for : onEvent "Registered SIP ..."

Hi piplz!

I have a little problem here. Imagine situation:

  • some WLan mobile client (some super WLan-IP-Handy) appears near Asterisk WLan and registers itself (lets say its already implemented by the client)
  • upon the registration Asterisk throws an Event “Registered bla”
  • upon the Event Asterisk or some script tells the PSTN to redirect all calls to the client from mobile to VoIP

Now what I need are some ideas for this problem… I thought about:

  • manager.h/c in asterisk can be accessed by some client apps and even reroutes the events to them, I dont know exactly if it really would do (and if u think its ok what clients do u think I could use?) Is the Event “Agentlogin” may be the right one?
  • AGI is funny stuff but its called in the extensions.conf so its too late
  • direct source coding would be possible but WHERE is this Event triggered? I tried to find the output “Registered…” with grep but no success so far (not the RIGHT one)…
  • may be there is some hidden command for some.conf that already notifies me about the registering? Now THAT would be really helpful :smile: U know, like:

…the problem is kind of urgent, many thx for any input on this!


Still no luck with the grasping of the event, but here may be a solution… I found an example of shell script and changed it a little for my needs; this script should be executed every 10 s and checks if a user is registered or not. If there is a change registered->unregistered or u->r then it could launch some app or directly sthing in asterisk. Its not tested though, e.g. if there is actually no asterisk running then I dont know what it says :smile: was too laizy to do sthin bout it…

There I have another problem: does somebody know a good example for call forwarding? IS there actually some function in asterisk to tell the PSTN over CAPI that some mobile number should be redirected to the asterisk instance?

asterisk:/home/rempel# cat

otpt=”$(/usr/sbin/asterisk -rx ‘sip show peers’ |grep rempel |grep Unspecified )"

if [ -z “$otpt” ]
# ALEX: empty str > registered > call forwarding on
# ALEX: “touching files” if u>r then ‘touch $peername’ if r>u then rm

    echo -n $otpt
    echo "$peername is registered"

    if  [ -f $peername ]
            echo "already marked as registered"
            echo "marking as registered"
            `touch $peername`
            # ALEX: start some call forward activating app

# ALEX: non empty str > unregistered > call forwarding off

    echo "$peername is unregistered"

    if  [ -f $peername ]
            echo "marking as unregistered"
            `rm $peername`
            # ALEX: deactivate call forwarding
            echo "already marked as unregistered"