Hi
I'm using Kamailio 3.1.5 and want to fork calls to all members in the same group defined in dbaliase. e.g. alias_username is 'clients' for 3 usernames: 'clientone', 'clienttwo', 'clientthree'.
If any of the 3 users are online, call to the alias_username 'clients' looks fine: INVITE is forked to all online users etc.
But problem comes when none of the users are online: in this case, t_relay will cause a server error 500, as server tries to relay to the user on trunk, e.g. clientone@domain.com, for which failed to find a location entry and uri remaied clientone@domain.com rather than an IP address.
I expected server to send a 404 if non of the users for alias_username 'clients' is online. How should I fix it please?
Following is relevant parts from my config file:
############################################################# route[LOCATION] { if ( alias_db_lookup("dbaliases") ) { t_on_branch("BRANCH_ALIASDB"); # in branch_route[BRANCH_ALIASDB], # call another route that looks up location, # if not existent, call drop()
} else { xlog("L_DBG","LOCATION: not alias - go to lookup location trunk\n"); route(LOCATION_TRUNK); # normal look up location and sending of 404 etc }
... ... } ############################################################# branch_route[BRANCH_ALIASDB] { xlog("L_DBG", "BRANCH_ALIASDB: $fU@$fd -> $rU@$rd; Method:$rm\n"); route(LOCATION_BRANCH); }
route[LOCATION_BRANCH] { if (!lookup("location")) { # Drop this branch - it's going nowhere drop(); } } ############################################################# route[RELAY] { xlog("L_DBG","RELAY: method=$rm, callid=$ci, cseq=$cs\n");
#!ifdef WITH_NAT if (check_route_param("nat=yes")) { setbflag(FLB_NATB); } if (isflagset(FLT_NATS) || isbflagset(FLB_NATB)) { xlog("L_DBG", "RELAY: about to call RTPPROXY\n"); route(RTPPROXY); } #!endif
/* example how to enable some additional event routes */ if (is_method("INVITE")) { t_on_reply("REPLY_ONE"); t_on_failure("FAIL_ONE"); }
if (!t_relay()) { sl_reply_error(); }
exit; }
############################################################# And in the main route, route LOCATION and RELAY are the last two routes: route { ...
# user location service route(LOCATION);
route(RELAY); }
Thanks very much!
Yufei -- Yufei Tao Red Embedded
This E-mail and any attachments hereto are strictly confidential and intended solely for the addressee. If you are not the intended addressee please notify the sender by return and delete the message.
You must not disclose, forward or copy this E-mail or attachments to any third party without the prior consent of the sender.
Red Embedded Design, Company Number 06688253 Registered in England: The Waterfront, Salts Mill Rd, Saltaire, BD17 7EZ
Hello,
On 12/13/11 2:31 PM, Yufei Tao wrote:
Hi
I'm using Kamailio 3.1.5 and want to fork calls to all members in the same group defined in dbaliase. e.g. alias_username is 'clients' for 3 usernames: 'clientone', 'clienttwo', 'clientthree'.
If any of the 3 users are online, call to the alias_username 'clients' looks fine: INVITE is forked to all online users etc.
But problem comes when none of the users are online: in this case, t_relay will cause a server error 500, as server tries to relay to the user on trunk, e.g. clientone@domain.com, for which failed to find a location entry and uri remaied clientone@domain.com rather than an IP address.
I expected server to send a 404 if non of the users for alias_username 'clients' is online. How should I fix it please?
500 is caused by doing drop to all branches, so tm creates the transaction, but there is no outgoing branch sent to network.
A nice solution for the future will be to add kind of t_reply_branch(...) which will set the reply code for the branch. t_reply() is working at transaction level.
Right now an option you can do is to set r-uri in branch route to something like 'sip:notfound@yourserverip' instead of drop and let the branch go out.
$ru = "sip:notfound@yourserverip";
The at the beginning of request route block you can test:
if(src_ip==yourserverip && $rU="notfound") { sl_send_reply("404", "not found"); exit; }
Cheers, Daniel
Following is relevant parts from my config file:
############################################################# route[LOCATION] { if ( alias_db_lookup("dbaliases") ) { t_on_branch("BRANCH_ALIASDB"); # in branch_route[BRANCH_ALIASDB], # call another route that looks up location, # if not existent, call drop()
} else { xlog("L_DBG","LOCATION: not alias - go to lookup location trunk\n"); route(LOCATION_TRUNK); # normal look up location and sending of 404 etc }
... ... } ############################################################# branch_route[BRANCH_ALIASDB] { xlog("L_DBG", "BRANCH_ALIASDB: $fU@$fd -> $rU@$rd; Method:$rm\n"); route(LOCATION_BRANCH); }
route[LOCATION_BRANCH] { if (!lookup("location")) { # Drop this branch - it's going nowhere drop(); } } ############################################################# route[RELAY] { xlog("L_DBG","RELAY: method=$rm, callid=$ci, cseq=$cs\n");
#!ifdef WITH_NAT if (check_route_param("nat=yes")) { setbflag(FLB_NATB); } if (isflagset(FLT_NATS) || isbflagset(FLB_NATB)) { xlog("L_DBG", "RELAY: about to call RTPPROXY\n"); route(RTPPROXY); } #!endif
/* example how to enable some additional event routes */ if (is_method("INVITE")) { t_on_reply("REPLY_ONE"); t_on_failure("FAIL_ONE"); }
if (!t_relay()) { sl_reply_error(); }
exit; }
############################################################# And in the main route, route LOCATION and RELAY are the last two routes: route { ...
# user location service route(LOCATION);
route(RELAY); }
Thanks very much!
Yufei
Yufei Tao Red Embedded
This E-mail and any attachments hereto are strictly confidential and intended solely for the addressee. If you are not the intended addressee please notify the sender by return and delete the message.
You must not disclose, forward or copy this E-mail or attachments to any third party without the prior consent of the sender.
Red Embedded Design, Company Number 06688253 Registered in England: The Waterfront, Salts Mill Rd, Saltaire, BD17 7EZ
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Hi Daniel
Thanks very much for the quick response - and it works fine now :)
Cheers, Yufei
On 13/12/11 16:05, Daniel-Constantin Mierla wrote:
Hello,
On 12/13/11 2:31 PM, Yufei Tao wrote:
Hi
I'm using Kamailio 3.1.5 and want to fork calls to all members in the same group defined in dbaliase. e.g. alias_username is 'clients' for 3 usernames: 'clientone', 'clienttwo', 'clientthree'.
If any of the 3 users are online, call to the alias_username 'clients' looks fine: INVITE is forked to all online users etc.
But problem comes when none of the users are online: in this case, t_relay will cause a server error 500, as server tries to relay to the user on trunk, e.g. clientone@domain.com, for which failed to find a location entry and uri remaied clientone@domain.com rather than an IP address.
I expected server to send a 404 if non of the users for alias_username 'clients' is online. How should I fix it please?
500 is caused by doing drop to all branches, so tm creates the transaction, but there is no outgoing branch sent to network.
A nice solution for the future will be to add kind of t_reply_branch(...) which will set the reply code for the branch. t_reply() is working at transaction level.
Right now an option you can do is to set r-uri in branch route to something like 'sip:notfound@yourserverip' instead of drop and let the branch go out.
$ru = "sip:notfound@yourserverip";
The at the beginning of request route block you can test:
if(src_ip==yourserverip && $rU="notfound") { sl_send_reply("404", "not found"); exit; }
Cheers, Daniel
Following is relevant parts from my config file:
############################################################# route[LOCATION] { if ( alias_db_lookup("dbaliases") ) { t_on_branch("BRANCH_ALIASDB"); # in branch_route[BRANCH_ALIASDB], # call another route that looks up location, # if not existent, call drop()
} else { xlog("L_DBG","LOCATION: not alias - go to lookup location trunk\n"); route(LOCATION_TRUNK); # normal look up location and sending of 404 etc }
... ... } ############################################################# branch_route[BRANCH_ALIASDB] { xlog("L_DBG", "BRANCH_ALIASDB: $fU@$fd -> $rU@$rd; Method:$rm\n"); route(LOCATION_BRANCH); }
route[LOCATION_BRANCH] { if (!lookup("location")) { # Drop this branch - it's going nowhere drop(); } } ############################################################# route[RELAY] { xlog("L_DBG","RELAY: method=$rm, callid=$ci, cseq=$cs\n");
#!ifdef WITH_NAT if (check_route_param("nat=yes")) { setbflag(FLB_NATB); } if (isflagset(FLT_NATS) || isbflagset(FLB_NATB)) { xlog("L_DBG", "RELAY: about to call RTPPROXY\n"); route(RTPPROXY); } #!endif
/* example how to enable some additional event routes */ if (is_method("INVITE")) { t_on_reply("REPLY_ONE"); t_on_failure("FAIL_ONE"); }
if (!t_relay()) { sl_reply_error(); }
exit; }
############################################################# And in the main route, route LOCATION and RELAY are the last two routes: route { ...
# user location service route(LOCATION);
route(RELAY); }
Thanks very much!
Yufei
Yufei Tao Red Embedded
This E-mail and any attachments hereto are strictly confidential and intended solely for the addressee. If you are not the intended addressee please notify the sender by return and delete the message.
You must not disclose, forward or copy this E-mail or attachments to any third party without the prior consent of the sender.
Red Embedded Design, Company Number 06688253 Registered in England: The Waterfront, Salts Mill Rd, Saltaire, BD17 7EZ
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- Yufei Tao Red Embedded
This E-mail and any attachments hereto are strictly confidential and intended solely for the addressee. If you are not the intended addressee please notify the sender by return and delete the message.
You must not disclose, forward or copy this E-mail or attachments to any third party without the prior consent of the sender.
Red Embedded Design, Company Number 06688253 Registered in England: The Waterfront, Salts Mill Rd, Saltaire, BD17 7EZ