From 7ee0bab9679c6ba4421a90f700997cd41d4ba731 Mon Sep 17 00:00:00 2001 From: drowe67 Date: Fri, 15 Jan 2010 03:37:10 +0000 Subject: [PATCH] moved voip line checks to sip show registry for voip lines, as sip show peers didn't indicate if password or user was wrong git-svn-id: https://svn.code.sf.net/p/freetel/code@115 01035d8c-6547-0410-b346-abe4f91aad63 --- easy-asterisk-gui/set_voiplines.pl | 3 +++ easy-asterisk-gui/sip.conf | 16 ++++------------ easy-asterisk-gui/voiplines.pl | 19 ++++++++++--------- easy-asterisk-gui/voiplines.sh | 4 ++-- 4 files changed, 19 insertions(+), 23 deletions(-) diff --git a/easy-asterisk-gui/set_voiplines.pl b/easy-asterisk-gui/set_voiplines.pl index 30a76be5..89c435d4 100755 --- a/easy-asterisk-gui/set_voiplines.pl +++ b/easy-asterisk-gui/set_voiplines.pl @@ -67,6 +67,9 @@ while () { if (/^user=/) { print "user=$user\n"; } + if (/^username=/) { + print "username=$user\n"; + } elsif (/^fromuser=/) { print "fromuser=$user\n"; } diff --git a/easy-asterisk-gui/sip.conf b/easy-asterisk-gui/sip.conf index ec78ce78..9ee3f209 100644 --- a/easy-asterisk-gui/sip.conf +++ b/easy-asterisk-gui/sip.conf @@ -153,7 +153,7 @@ srvlookup=yes ; Enable DNS SRV lookups on outbound calls ; register easy-asterisk voip line providers here -;register => user@voip ; easy-asterisk - do not change this comment +register => user@generic ; easy-asterisk - do not change this comment ;register => user@oeg ; easy-asterisk - do not change this comment ;----------------------------------------- NAT SUPPORT ------------------------ @@ -451,7 +451,6 @@ srvlookup=yes ; Enable DNS SRV lookups on outbound calls type=friend context=default host=dynamic -user=6011 secret=6011 canreinvite=no callerid=6011 @@ -463,7 +462,6 @@ qualify=yes type=friend context=default host=dynamic -user=6012 secret=6012 canreinvite=no callerid=6012 @@ -474,7 +472,6 @@ allow=ulaw,g729 type=friend context=default host=dynamic -user=6013 secret=6013 canreinvite=no callerid=6013 @@ -485,7 +482,6 @@ allow=ulaw,g729 type=friend context=default host=dynamic -user=6014 secret=6014 canreinvite=no callerid=6014 @@ -496,7 +492,6 @@ allow=ulaw,g729 type=friend context=default host=dynamic -user=6015 secret=6015 canreinvite=no callerid=6015 @@ -507,7 +502,6 @@ allow=ulaw,g729 type=friend context=default host=dynamic -user=6016 secret=6016 canreinvite=no callerid=6016 @@ -518,7 +512,6 @@ allow=ulaw,g729 type=friend context=default host=dynamic -user=6017 secret=6017 canreinvite=no callerid=6017 @@ -529,7 +522,6 @@ allow=ulaw,g729 type=friend context=default host=dynamic -user=6018 secret=6018 canreinvite=no callerid=6018 @@ -538,10 +530,10 @@ allow=ulaw,g729 ; Pre-configured easy-asterisk SIP trunks -[voip] ; "Generic" easy-asterisk do not remove this comment +[generic] ; "Generic" easy-asterisk do not remove this comment type=friend context=default -user=user +username=user secret=password host=192.168.1.28 canreinvite=no @@ -552,7 +544,7 @@ qualify=yes ;[oeg] ; "OEG" easy-asterisk do not remove this comment ;host=voip.oeg.com.au ;secret=pass -;user=your user number +;username=your user number ;fromdomain=voip.oeg.com.au ;fromuser=your user number ;insecure=port,invite diff --git a/easy-asterisk-gui/voiplines.pl b/easy-asterisk-gui/voiplines.pl index 240e7f6b..78c6f81e 100755 --- a/easy-asterisk-gui/voiplines.pl +++ b/easy-asterisk-gui/voiplines.pl @@ -50,6 +50,9 @@ while () { if (/^;*user=(.*)/) { $user{$provider} = $1; } + if (/^;*username=(.*)/) { + $user{$provider} = $1; + } if (/^;*secret=(.*)/) { $pass{$provider} = $1; } @@ -66,19 +69,14 @@ close SIP; # sipshowpeers.txt needs to be generated before calling this perl # script -my %voip = (); # SIP trunks status keyed on sip.conf stanza names +my %voip = (); # SIP trunks status keyed on sip.conf stanza name/username # if no entry we can't see SIP trunk -open SIP, "sipshowpeers.txt"; +open SIP, "sipshowregistry.txt"; while () { - if (/^(\S*).*(OK)/) { + if (/^(.*):.*(Registered)/) { $voip{$1} = $2; print "'$1' '$2' $voip{$1}\n"; - $e = $1; - if (/\s([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)\s/) { - $ipad{$e} = $1; - #print "'$1'\n"; - } } } @@ -122,7 +120,10 @@ print "\n"; print "User:\n"; print "Password:\n"; print "Host:\n"; -if ($voip{$stanza{$provider_current}} eq "OK") { + +print "\nXXX $provider_current $stanza{$provider_current} $voip{$stanza{$provider_current}}\n"; + +if ($voip{$stanza{$provider_current}} eq "Registered") { $icon = "\"OK\""; } else { diff --git a/easy-asterisk-gui/voiplines.sh b/easy-asterisk-gui/voiplines.sh index 6891eac9..071408e3 100644 --- a/easy-asterisk-gui/voiplines.sh +++ b/easy-asterisk-gui/voiplines.sh @@ -15,9 +15,9 @@ if [ $? -eq 1 ]; then exit fi -# See if we have can reach the VOIP Line host +# See if we have can reach the VOIP Line provider -asterisk "-rx sip show peers" 2>/dev/null > sipshowpeers.txt +asterisk "-rx sip show registry" 2>/dev/null > sipshowregistry.txt # Construct the web page ------------------------------- -- 2.25.1