Use case 1:
convert the username consisting of letters in incoming INVITE from your VoIP provider to digits
(e.g. INVITE: rt_user1@192.168.1.203 -> INVITE: 13511654321@192.168.1.203, where country-city-subscriber is 1-3511-654321):
Add to your dialplan table:
INSERT INTO dialplan VALUES \
(1002,0,0,'rt_user1',1,'','13511654321',NULL,0,'modifying letters to digits in provider''s ruri');
So, the SQL record is as follows:
sqlite> select * from dialplan where dpid=1002;
id = 2
dpid = 1002
pr = 0
match_op = 0 # Matching operator for rule (0-equal, 1-regexp).
match_exp = rt_user1
match_flags = 1
subst_exp =
repl_exp = 13511654321
timerec =
disabled = 0
attrs = modifying letters to digits in provider's ruri
A piece of code from your OpenSIPS config:
dp_translate(1002, $rU, $var(out), $var(attrs));
xlog("L_INFO", "[$ci] method: $rm . orig uri: $ou . rU: $rU . translated into var(out) . attrs fetched: $var(attrs) \n");
We will use sipvicious for tests:
sipvicious_svmap 192.168.1.203 -m INVITE -e rt_user1
Matching flags (0-case sensitive, 1-case insensitive) – I’ve tested both with 0 and 1 values in ‘match_flags’ column and with sending INVITE with r-uri username in both cases (rt_user1 and rt_usER1), and it worked as desired. Use this if needed.
Here is how the OpenSIPS log looks like:
INFO:[663875316192451266446661] method: INVITE . orig uri: sip:rt_user1@192.168.1.203 . rU: rt_user1 . translated into 13511654321 . attrs fetched: modifying letters to digits in provider's ruri
Use case 2:
convert the username in incoming INVITE from your VoIP provider to e164 format
(e.g. INVITE: +83533444444@192.168.1.203 -> INVITE: 73533444444@192.168.1.203):
Add to your dialplan table (for testing purposes I use a separate dialplan id (dpid)):
INSERT INTO dialplan VALUES \
(1003,0,1,'^(\+73533|83533|\+83533)444444',0,'^(\+73533|83533|\+83533)(.+)','73533\2',NULL,0,'modifying rU variations to e164');
The SQL record will look like this:
sqlite> select * from dialplan where dpid=1003;
id = 3
dpid = 1003
pr = 0
match_op = 1 # Matching operator for rule (0-equal, 1-regexp).
match_exp = ^(\+73533|83533|\+83533)444444
match_flags = 0
subst_exp = ^(\+73533|83533|\+83533)(.+)
repl_exp = 73533\2
timerec =
disabled = 0
attrs = modifying rU variations to e164
A piece of code from your OpenSIPS config (for testing purposes I use a separate dialplan id (dpid)):
dp_translate(1003, $rU, $var(out2), $var(attrs2));
xlog("L_INFO", "[$ci] method: $rm . orig uri: $ou . rU: $rU . translated into $var(out2) . attrs fetched: $var(attrs2) \n");
Sipvicious commands for tests:
sipvicious_svmap 192.168.1.203 -m INVITE -e +73533444444
sipvicious_svmap 192.168.1.203 -m INVITE -e 83533444444
sipvicious_svmap 192.168.1.203 -m INVITE -e +83533444444
OpenSIPS log:
INFO:[612608355179772675168706] method: INVITE . orig uri: sip:+83533444444@192.168.1.203 . rU: +83533444444 . translated into 73533444444 . attrs fetched: modifying rU variations to e164