Skip to content

Commit 261638b

Browse files
committed
Fix SUBSCRIBE to reg events upon UE deregister
1 parent 64c3124 commit 261638b

1 file changed

Lines changed: 60 additions & 47 deletions

File tree

smsc/kamailio_smsc.cfg

Lines changed: 60 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,13 @@ modparam("pua_reginfo", "server_address", "sip:SMSC_SERVER")
8787
modparam("pua_reginfo", "publish_reginfo", 0)
8888
modparam("pua", "db_url", DIALPLAN_PUA_DB_URL)
8989

90+
#!ifdef WITH_DEBUG
91+
loadmodule "debugger.so"
92+
modparam("debugger", "mod_hash_size", 5)
93+
modparam("debugger", "mod_level_mode", 1)
94+
modparam("debugger", "mod_level", "xlog=3")
95+
#!endif
96+
9097
####### Routing Logic ########
9198
# Main SIP request routing logic
9299
# - processing of any incoming SIP request starts with this route
@@ -153,8 +160,8 @@ route[REQINIT] {
153160
######################################################################
154161
route[SMS_FROM_3GPP] {
155162
#!ifdef WITH_DEBUG
156-
xlog("3GPP-SMS: $rm ($fu ($si:$sp) to $tu, $ci)\n");
157-
xlog("SMS for $tpdu(destination) \"$tpdu(payload)\" (Valid: $tpdu(validity) )\n");
163+
xlog("L_DBG", "3GPP-SMS: $rm ($fu ($si:$sp) to $tu, $ci)\n");
164+
xlog("L_DBG", "SMS for $tpdu(destination) \"$tpdu(payload)\" (Valid: $tpdu(validity) )\n");
158165
#!endif
159166
send_reply("202", "Accepted");
160167

@@ -176,12 +183,12 @@ route[SMS_FROM_3GPP] {
176183

177184
$avp(text) = $tpdu(payload);
178185
#!ifdef WITH_DEBUG
179-
xlog("SMS from 3GPP/VoLTE\n");
180-
xlog("-------------------------------------\n");
181-
xlog("FROM $avp(from)\n");
182-
xlog("TO $avp(to)\n");
183-
xlog("TEXT $avp(text)\n");
184-
xlog("DCS $avp(dcs)\n");
186+
xlog("L_DBG", "SMS from 3GPP/VoLTE\n");
187+
xlog("L_DBG", "-------------------------------------\n");
188+
xlog("L_DBG", "FROM $avp(from)\n");
189+
xlog("L_DBG", "TO $avp(to)\n");
190+
xlog("L_DBG", "TEXT $avp(text)\n");
191+
xlog("L_DBG", "DCS $avp(dcs)\n");
185192
#!endif
186193
route(SMS);
187194
}
@@ -201,11 +208,11 @@ route[SMS_FROM_SIP] {
201208
dp_translate("1", "$avp(to)/$avp(to)");
202209
$avp(text) = $rb;
203210
#!ifdef WITH_DEBUG
204-
xlog("SMS from SIP/OTT\n");
205-
xlog("-------------------------------------\n");
206-
xlog("FROM $avp(from)\n");
207-
xlog("TO $avp(to)\n");
208-
xlog("TEXT $avp(text)\n");
211+
xlog("L_DBG", "SMS from SIP/OTT\n");
212+
xlog("L_DBG", "-------------------------------------\n");
213+
xlog("L_DBG", "FROM $avp(from)\n");
214+
xlog("L_DBG", "TO $avp(to)\n");
215+
xlog("L_DBG", "TEXT $avp(text)\n");
209216
#!endif
210217
route(SMS);
211218

@@ -223,11 +230,11 @@ event_route[xhttp:request] {
223230
$avp(text) = $(hu{url.querystring}{param.value,text,&}{s.replace,+,%20}{s.unescape.user});
224231
$avp(from_outbound) = 1;
225232
#!ifdef WITH_DEBUG
226-
xlog("SMS from Outbound ($hu)\n");
227-
xlog("-------------------------------------\n");
228-
xlog("FROM $avp(from)\n");
229-
xlog("TO $avp(to)\n");
230-
xlog("TEXT $avp(text)\n");
233+
xlog("L_DBG", "SMS from Outbound ($hu)\n");
234+
xlog("L_DBG", "-------------------------------------\n");
235+
xlog("L_DBG", "FROM $avp(from)\n");
236+
xlog("L_DBG", "TO $avp(to)\n");
237+
xlog("L_DBG", "TEXT $avp(text)\n");
231238
#!endif
232239
if ($avp(to) == "491771782261")
233240
$avp(to) = "494046895124";
@@ -245,12 +252,12 @@ event_route[xhttp:request] {
245252
######################################################################
246253
route[SMS_TO_3GPP] {
247254
#!ifdef WITH_DEBUG
248-
xlog("SMS to 3GPP/VoLTE\n");
249-
xlog("-------------------------------------\n");
250-
xlog("FROM $avp(from)\n");
251-
xlog("TO $avp(to)\n");
252-
xlog("TEXT $avp(text)\n");
253-
xlog("DCS $avp(dcs)\n");
255+
xlog("L_DBG", "SMS to 3GPP/VoLTE\n");
256+
xlog("L_DBG", "-------------------------------------\n");
257+
xlog("L_DBG", "FROM $avp(from)\n");
258+
xlog("L_DBG", "TO $avp(to)\n");
259+
xlog("L_DBG", "TEXT $avp(text)\n");
260+
xlog("L_DBG", "DCS $avp(dcs)\n");
254261
#!endif
255262

256263
// Construct a new SMS-Body:
@@ -279,11 +286,11 @@ route[SMS_TO_3GPP] {
279286
######################################################################
280287
route[SMS_TO_SIP] {
281288
#!ifdef WITH_DEBUG
282-
xlog("SMS to SIP/OTT\n");
283-
xlog("-------------------------------------\n");
284-
xlog("FROM $avp(from)\n");
285-
xlog("TO $avp(to)\n");
286-
xlog("TEXT $avp(text)\n");
289+
xlog("L_DBG", "SMS to SIP/OTT\n");
290+
xlog("L_DBG", "-------------------------------------\n");
291+
xlog("L_DBG", "FROM $avp(from)\n");
292+
xlog("L_DBG", "TO $avp(to)\n");
293+
xlog("L_DBG", "TEXT $avp(text)\n");
287294
#!endif
288295

289296
$uac_req(method) = "MESSAGE";
@@ -302,11 +309,11 @@ route[SMS_TO_SIP] {
302309
######################################################################
303310
route[SMS_TO_OUTBOUND] {
304311
#!ifdef WITH_DEBUG
305-
xlog("SMS to Outbound\n");
306-
xlog("-------------------------------------\n");
307-
xlog("FROM $avp(from)\n");
308-
xlog("TO $avp(to)\n");
309-
xlog("TEXT $avp(text)\n");
312+
xlog("L_DBG", "SMS to Outbound\n");
313+
xlog("L_DBG", "-------------------------------------\n");
314+
xlog("L_DBG", "FROM $avp(from)\n");
315+
xlog("L_DBG", "TO $avp(to)\n");
316+
xlog("L_DBG", "TEXT $avp(text)\n");
310317
#!endif
311318
if ($avp(from_outbound) == 1) {
312319
xlog("Not sending: FROM and TO Outbound!\n");
@@ -331,12 +338,12 @@ route[SMS_TO_OUTBOUND] {
331338
######################################################################
332339
route[SMS] {
333340
#!ifdef WITH_DEBUG
334-
xlog("SMS-Task\n");
335-
xlog("-------------------------------------\n");
336-
xlog("FROM $avp(from)\n");
337-
xlog("TO $avp(to)\n");
338-
xlog("TEXT $avp(text)\n");
339-
xlog("DCS $avp(dcs)\n");
341+
xlog("L_DBG", "SMS-Task\n");
342+
xlog("L_DBG", "-------------------------------------\n");
343+
xlog("L_DBG", "FROM $avp(from)\n");
344+
xlog("L_DBG", "TO $avp(to)\n");
345+
xlog("L_DBG", "TEXT $avp(text)\n");
346+
xlog("L_DBG", "DCS $avp(dcs)\n");
340347
#!endif
341348

342349
# Query ENUM: Local number?
@@ -378,11 +385,11 @@ route[SMS_WORKER] {
378385

379386
route(SEND_SMS);
380387
#!ifdef WITH_DEBUG
381-
xlog("ID $avp(id)\n");
382-
xlog("FROM $avp(from)\n");
383-
xlog("TO $avp(to)\n");
384-
xlog("TEXT $avp(text)\n");
385-
xlog("DCS $avp(dcs)\n");
388+
xlog("L_DBG", "ID $avp(id)\n");
389+
xlog("L_DBG", "FROM $avp(from)\n");
390+
xlog("L_DBG", "TO $avp(to)\n");
391+
xlog("L_DBG", "TEXT $avp(text)\n");
392+
xlog("L_DBG", "DCS $avp(dcs)\n");
386393
#!endif
387394
}
388395

@@ -394,8 +401,14 @@ route[SMS_WORKER] {
394401

395402
route[NOTIFY] {
396403
if (has_body("application/reginfo+xml")) {
397-
if (reginfo_handle_notify("location"))
398-
send_reply("202", "Accepted");
404+
reginfo_handle_notify("location");
405+
if ($rc == 2) {
406+
# All contacts of the IMPU are de-registered
407+
xnotice("All contacts de-registered for $fu\n");
408+
$sht(publish_sent=>$fu) = $null;
409+
}
410+
# Send 202 Accepted response for all cases
411+
send_reply("202", "Accepted");
399412
} else {
400413
send_reply("503", "Invalid Content-Type");
401414
}

0 commit comments

Comments
 (0)