
| Current Path : /etc/asterisk/asterisk_loopthrough/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : //etc/asterisk/asterisk_loopthrough/config.py |
# call config.py to update data
# then on ift server copy extension_global.conf -> /etc/asterisk/extensions.conf
# then on local servers copy extension_local.conf -> /etc/asterisk/extensions.conf
# then on ift server copy sip_global.conf -> /etc/asterisk/sip.conf actualize the networks
# then on local servers copy sip_local.conf -> /etc/asterisk/sip.conf actualize the networks
# Link this directory to /etc/asterisk
# In Linphone, switch off +49 in account settings
import sys,re,os,random
phone_numbers = {} # locations with fritz boxes, add these to the
countries1 = "0,0049,0043,00387,00385,00381,0086,00237,0044,0041"
phone_numbers["172.20.20.19"] = [ "192.168.153.254", # fuerth, rockig
"499112878343", "widor124", "0," + countries1,
"499112878376", "widor124", "0,0049,0043",
"4991138467922", "widor124", "0," + countries1,
"4991130006130", "widor124", "0,0049,0043,00387" ]
# Gmuend Vodafone 001960601261 DSL: vodafone-vdsl.komplett/vb8949902299 87376tws (install: 36834 39506 26164 14637)
phone_numbers["172.20.20.18"] = [ "192.168.5.254", # gmuend, kuchen1637
"4971719994570", "widor124", "0," + countries1, # sommer2025--
"4971719994571", "widor124", "0," + countries1, # sommer2024--
"4971719994572", "widor124", "0," + countries1 ] # sommer2023--
for host in phone_numbers:
ext = ""
sip1 = ""
sip2 = "\n\n\n"
user = "00"
host_intern = phone_numbers[host].pop(0)
while (0 == 0):
if len(phone_numbers[host]) < 2:
break
nr = phone_numbers[host].pop(0)
password = phone_numbers[host].pop(0)
countries = phone_numbers[host].pop(0)
ext = ext + '''
[context'''+nr+''']
exten => '''+user+nr+''',1,Dial(SIP/00'''+nr+''')
'''
for country in countries.split(","):
ext = ext + 'exten => _' + country + '[1-9].,1,Dial(SIP/${EXTEN}@to'+nr+')' + "\n"
sip1 = sip1 + '''
register => '''+user+nr+''':'''+password+'''@---HOST---/'''+user+nr
sip2 = sip2 + '''
[00'''+nr+''']
type=friend
secret='''+password+'''
host=dynamic
context=context'''+nr+'''
[to'''+nr+''']
host=---HOST---
fromdomain=---HOST---
username='''+user+nr+'''
fromuser='''+user+nr+'''
secret='''+password+'''
context=context'''+nr+'''
type=peer
transport=udp,tcp
insecure=port,invite
'''
open( "extensions." + host.replace(".","_") ,"w").write(ext+"\n")
open( "register_local." + host.replace(".","_") ,"w").write( sip1.replace("---HOST---",host_intern) )
open( "register_global." + host.replace(".","_") ,"w").write( sip1.replace("---HOST---",host) )
open( "sip_local." + host.replace(".","_") ,"w").write( sip2.replace("---HOST---",host_intern) )
open( "sip_global." + host.replace(".","_") ,"w").write( sip2.replace("---HOST---",host) )