[asterisk-users] Define an array of sip number in sip.conf
Leif Madsen
leif.madsen at asteriskdocs.org
Fri Mar 19 09:11:17 CDT 2010
Zeeshan Zakaria wrote:
> You'll have to type them all in manually. Or do what I did several
> times, write a script in php which will generate the sip.conf with that
> many extensions. Even better look into using realtime architecture,
> where you can quickly generate as many extensions as you like.
Using the script approach, you can generate many extensions with an #exec in
sip.conf which will then trigger a script (such as via PHP or whatever) and
whatever information you output via STDOUT will then be used when chan_sip is
loaded.
Using a template will make what you need to output much easier.
Something like...
#!/usr/bin/php
<?php
$x=1000;
while ($x < 2000) {
echo "[$x](my_template)\n";
$x++;
};
?>
Then define in sip.conf [my_template](!)
Then fill in whatever information you need for the extensions.
Then you can use
#exec make_extensions.php
Leif.
More information about the asterisk-users
mailing list