Some of you have unusual SIP configurations, and this SIP perl script may be useful to get remote devices registering with your Asterisk or other SIP server. Most Cisco routers, as an example, are too stupid to REGISTER, so this script would be required to dynamically register them with a remote server. This may not be 100% applicable to Asterisk, since static registrations are possible, but who knows? Maybe someone will find this useful. There is no password support on this version. I haven't fooled around extensively with the script - feel free to modify and re-submit a better working copy. If anyone wants to build the password-capable version of this, some tools can be found in the SER package (http://www.iptel.org/ser/) in the "utils/gen_ha1" directory - there is a password generator in there, along with C routines for WWW-Authorize responses. Notes: Replace "123.123.123.123" with the IP address of the remote SIP server that you're trying to REGISTER with. Replace "sipdomain.company.com" with the domain you're using. This may not matter much for some SIP servers, but others are fussy about it. Change the "Expires: " value to whatever you think is useful. It's measured in seconds. Change "John Doe <sip:jdoe@foo.bar.net>" to your contact info (probably something like "<sip:99999@1.2.3.4>") JT Original script by Marian Durkovic ---------------------------- cut here ------------------------------- #!/usr/bin/perl use Socket; # USAGE register { local IP address, Extension number, SIP contact address } register("1.2.3.4", "99999", "John Doe <sip:jdoe\@foo.bar.net>"); sub register { $local_ip = shift; $ext_number = shift; $contact = shift; $proxy_ip = "123.123.123.123"; $tm = time(); $seq = $tm % 65536; $MESG="REGISTER sip:sipdomain.company.com SIP/2.0 Via: SIP/2.0/UDP $local_ip:5060 From: <sip:$ext_number\@sipdomain.company.com> To: <sip:$ext_number\@sipdomain.company.com> Contact: $contact Call-ID: $tm\@$local_ip CSeq: $seq REGISTER Expires: 3700 Content-Length: 0 "; $proto = getprotobyname('udp'); socket(SOCKET, PF_INET, SOCK_DGRAM, $proto) ; $iaddr = inet_aton("$local_ip"); $paddr = sockaddr_in(5060, $iaddr); bind(SOCKET, $paddr) ; $port=5060; $hisiaddr = inet_aton($proxy_ip) ; $hispaddr = sockaddr_in($port, $hisiaddr); send(SOCKET, $MESG, 0,$hispaddr ) || warn "send $host $!\n"; } ---------------------------- cut here -------------------------------