Listening in to Sip calls

dear users,

for a sci fi larp we use asterisk with the sip protocol for communicating, assignments, quests etc,
the only thing is that the game leader needs to listen in to the calls made. dont worry about privacy these calls are made in character and the players know that they may be hacked or listened to.

what ik like to see is that as soon as an extention is called for example 6002, that simultaniously another extension like 6000 is called so that the gameleader (extention 6000) can eavesdrop.

another solution can be the constant eavesdropping of the SIP line.

is there anyone who can help me setting this up or can paste a snippet with a little bit of explenation on how it works.

thnx in advance

You could write an AGI script that dials the game leaders phone automatically.

In your extensions.conf put something like the following:

[code]exten 6XXX,1,AGI(nameofyourscript.agi)
exten 6XXX,n,Dial(SIP/${EXTEN},20)
exten 6XXX,n,Hangup()

exten 76XXX,1,ChanSpy(SIP/${ExtToSpy},q)

Then you need to write the agi script in Perl. The script needs to get the channel variable for the extension that was dialed and then store it to the variable ExtToSpy. The script needs to then execute a command with the following items in the command:

Action: Originate
Channel: (sip/the extension of the game leader)
Context:  (the context that the 6XXX and 76XXX dialplan section is in)
Exten: (the extension that the original person was calling with a 7 in front ex: 76002)
Priority: 1
Callerid: (whatever you want)
Timeout: (whatever you want)

Here’s what should happen:

6001 - Player 1
6002 - Player 2

6999 - Game leader

Player 1 dials 6002. The script is triggered. It gets the extension number dialed 6002 and stores it to a variable. The game leader’s phone will ring with the number supplied in the callerid string. When he answers the phone, it will connect him to 76002 which in turn is the dialplan extension to spy on 6002 allowing him to hear both 6002 and the person who called them.

If you need help with the script, let me know.

dear sir/madam,

i would like to get the context: and exten: explained in the script.
since i’m a little bit of a noob.
plus asterisk is installed on a synology NAS so i cannot make an AGI files unless you have suggestions to do that.
greets, jean

If you don’t understand context and extension, you need to read and understand

If you don’t have permission to run AGI, etc., you need to get that permission.

AGI should run on any platform on which Asterisk runs, if you choose an appropriate scripting language.

well the problem is that the synology NAS does run AGI but i cant get scripts to the device

If this asterisk system isn’t yours, you should not be attempting any of this stuff. I thought you were working on an install of asterisk specifically for your game. Without access to the dialplan and the manager.conf settings, none of it will work anyway and opening up the manager interface on a production system, unless you need it, is just opening possible vulnerabilities.

the system is mine, but it locked me out of the root file system.
so i cannot input any other files, but i can modify all the .conf files

so i’ve got a raspberry pi with asterisk on it so maybe i’ll try on that