[OpenSIPS-Users] Get IP/Port of registered user (or from Location table?)
bluerain
frank21118 at yahoo.com
Fri Nov 15 18:30:41 CET 2013
Hello Bogdan,
I tried to use lookup("location","d","FRANK101") and it seems opensips can
not find the user, even though the username "FRANK101" is in the subcriber
table.
So it is my syntax is wrong on the "lookup" function call?
And please correct me if I am wrong also, I was under the impression that if
an INVITE comes in from Asterisk with
R-URI: 2135551212 at IP
TO-URI: 2135551212 at IP
And obviously opensip will not know who is "2135551212" because "2135551212"
is NOT in the subscriber table.
So here is my code
if (is_method("INVITE")) {
if (!lookup("location","m")){
switch($rc)
{
case -1:
if
(!lookup("location","d","FRANK101")) {
t_reply("404","Not Found");
exit;
}
case -3:
t_newtran();
t_reply("404","Not Found");
exit;
case -2:
sl_send_reply("405", "Method Not Allowed");
exit;
}
}
route(relay);
}
So with the code above, I:
1. lookup to see if the INVITE is a valid user in subscriber database
2. If not an valid user, which in this case it is because asterisk sent in
an invite with "2135551212"
3. Thus I use the funcation call, lookup("location","d","FRANK101"), which
"FRANK101" is a valid user in the "subscriber" table.
4. by calling the funcation call, lookup("location","d","FRANK101"), I am
expecting that opensips will NOT TOUCH either the TO-URI NOR the R-URI. It
will keep those the same as 2135551212 at IP, BUT now opensips will sent the
INVTIE to FRANK101 BECAUES the "lookup" function call only change the
IP/Port of the INVITE where it suppose to go?
Is my assumption correct? Or will "lookup" function also change the R-URI
and the TO-URI? If that is the case, then is useless.
And if lookup is work the way I thought, then please tell me what is the
exact syntax in reference to a user in the subscriber table?
What is the AOR parameter for the lookup? Is it not simply as the username?
Or do I need to put username at IP then what is the "@IP"? is the "@IP" the
"domain" field in the subscriber table? Or is it what is in the location
table? and if is in the location table, then do I take the entire "contact"
field and stuff that in to the lookup AOR parameter?
Thank you!
--
View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/Get-IP-Port-of-registered-user-or-from-Location-table-tp7588494p7588540.html
Sent from the OpenSIPS - Users mailing list archive at Nabble.com.
More information about the Users
mailing list