File tree Expand file tree Collapse file tree 1 file changed +22
-3
lines changed Expand file tree Collapse file tree 1 file changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -72,7 +72,14 @@ def register
72
72
end
73
73
74
74
chall = nil
75
- if res [ 2 ] [ 14 ] == "\x00 \x03 " and res [ 2 ] [ IAX_IE_CHALLENGE_DATA ]
75
+
76
+ # Look for IAX_AUTH_MD5 (2) as an available auth method
77
+ if res [ 2 ] [ 14 ] . unpack ( "n" ) [ 0 ] & 2 <= 0
78
+ dprint ( "REGAUTH: MD5 authentication is not enabled on the server" )
79
+ return
80
+ end
81
+
82
+ if res [ 2 ] [ IAX_IE_CHALLENGE_DATA ]
76
83
self . dcall = res [ 0 ] [ 0 ]
77
84
chall = res [ 2 ] [ IAX_IE_CHALLENGE_DATA ]
78
85
end
@@ -114,9 +121,21 @@ def dial(number)
114
121
# Handle authentication if its requested
115
122
if res [ 1 ] == IAX_SUBTYPE_AUTHREQ
116
123
chall = nil
117
- if res [ 2 ] [ 14 ] == "\x00 \x03 " and res [ 1 ] [ 15 ]
124
+
125
+ # Look for IAX_AUTH_MD5 (2) as an available auth method
126
+ if res [ 2 ] [ 14 ] . unpack ( "n" ) [ 0 ] & 2 <= 0
127
+ dprint ( "REGAUTH: MD5 authentication is not enabled on the server" )
128
+ return
129
+ end
130
+
131
+ if res [ 2 ] [ IAX_IE_CHALLENGE_DATA ]
118
132
self . dcall = res [ 0 ] [ 0 ]
119
- chall = res [ 2 ] [ 15 ]
133
+ chall = res [ 2 ] [ IAX_IE_CHALLENGE_DATA ]
134
+ end
135
+
136
+ if chall . nil?
137
+ dprint ( "REGAUTH: No challenge data received" )
138
+ return
120
139
end
121
140
122
141
self . client . send_authrep_chall_response ( self , chall )
You can’t perform that action at this time.
0 commit comments