Browse code

ims_charging: fix missing line-breaks for log messages

Henning Westerholt authored on 10/06/2020 11:50:51
Showing 9 changed files
... ...
@@ -300,7 +300,7 @@ Ro_CCA_t *Ro_parse_CCA_avps(AAAMessage *cca) {
300 300
                 mscc_avp_list_ptr = &mscc_avp_list;
301 301
                 AAA_AVP *mscc_avp = mscc_avp_list_ptr->head;
302 302
                 while (mscc_avp != NULL) {
303
-                    LM_DBG("MSCC AVP code is [%i] and data length is [%i]", mscc_avp->code, mscc_avp->data.len);
303
+                    LM_DBG("MSCC AVP code is [%i] and data length is [%i]\n", mscc_avp->code, mscc_avp->data.len);
304 304
                     switch (mscc_avp->code) {
305 305
                             AAA_AVP_LIST y;
306 306
                             AAA_AVP *z;
... ...
@@ -58,7 +58,7 @@ void dlg_answered(struct dlg_cell *dlg, int type, struct dlg_cb_params *_params)
58 58
     ro_session_lock(ro_session_table, ro_session_entry);
59 59
 
60 60
     if (session->active) {
61
-        LM_CRIT("Why the heck am i receiving a double confirmation of the dialog? Ignoring... ");
61
+        LM_CRIT("Why the heck am i receiving a double confirmation of the dialog? Ignoring...\n");
62 62
         ro_session_unlock(ro_session_table, ro_session_entry);
63 63
         return;
64 64
     } else if (session->active < 0) {   //session has already been terminated - we can't reactivate...
... ...
@@ -152,7 +152,7 @@ void dlg_terminated(struct dlg_cell *dlg, int type, unsigned int termcode, char*
152 152
 			s_reason = h->body;
153 153
 		}
154 154
 	} else if (_params->rpl) {
155
-		LM_DBG("Reply is [%d - %.*s]", _params->rpl->first_line.u.reply.statuscode, _params->rpl->first_line.u.reply.reason.len, _params->rpl->first_line.u.reply.reason.s);
155
+		LM_DBG("Reply is [%d - %.*s]\n", _params->rpl->first_line.u.reply.statuscode, _params->rpl->first_line.u.reply.reason.len, _params->rpl->first_line.u.reply.reason.s);
156 156
 	}
157 157
 	
158 158
 	ro_session = (struct ro_session*)*_params->param;
... ...
@@ -182,7 +182,7 @@ void dlg_terminated(struct dlg_cell *dlg, int type, unsigned int termcode, char*
182 182
 				//If however, the call was never answered, then we can continue as normal
183 183
 				ro_session_lock(ro_session_table, ro_session_entry);
184 184
                                 
185
-                                LM_DBG("processing dlg_terminated in Ro and session [%.*s] has active = %d", ro_session->ro_session_id.len, ro_session->ro_session_id.s, ro_session->active);
185
+                                LM_DBG("processing dlg_terminated in Ro and session [%.*s] has active = %d\n", ro_session->ro_session_id.len, ro_session->ro_session_id.s, ro_session->active);
186 186
 				if ((!ro_session->active && (ro_session->start_time != 0)) || (ro_session->ccr_sent == 1)) {
187 187
 					unref_ro_session(ro_session,1,0);
188 188
 					LM_DBG("CCR already sent or Ro Session is not active, but may have been answered [%d]\n", (int)ro_session->start_time);
... ...
@@ -31,7 +31,7 @@ void RoChargingResponseHandler(AAAMessage *response, void *param) {
31 31
             LM_ERR("DBG:"M_NAME":RoChargingResponseHandler(): - Received unknown response for app %d command %d\n",
32 32
                     response->applicationId,
33 33
                     response->commandCode);
34
-            LM_ERR("Response is [%s]", response->buf.s);
34
+            LM_ERR("Response is [%s]\n", response->buf.s);
35 35
             return;
36 36
 
37 37
     }
... ...
@@ -502,7 +502,7 @@ static int w_ro_ccr(struct sip_msg *msg, char* c_route_name, char* c_direction,
502 502
 	
503 503
 
504 504
 	if (msg->first_line.type != SIP_REQUEST) {
505
-	    LM_ERR("Ro_CCR() called from SIP reply.");
505
+	    LM_ERR("Ro_CCR() called from SIP reply.\n");
506 506
 	    return RO_RETURN_ERROR;;
507 507
 	}
508 508
 	
... ...
@@ -519,12 +519,12 @@ static int w_ro_ccr(struct sip_msg *msg, char* c_route_name, char* c_direction,
519 519
 	if (dir == RO_ORIG_DIRECTION) {
520 520
 		//get caller IMPU from asserted identity
521 521
 		if ((identity = cscf_get_asserted_identity(msg, 0)).len == 0) {
522
-			LM_DBG("No P-Asserted-Identity hdr found. Using From hdr for asserted_identity");
522
+			LM_DBG("No P-Asserted-Identity hdr found. Using From hdr for asserted_identity\n");
523 523
 			identity = dlg->from_uri;
524 524
 		}
525 525
 		//get caller contact from contact header - if not present then skip this
526 526
 		if ((contact = cscf_get_contact(msg)).len == 0) {
527
-		    LM_WARN("Can not get contact from message - will not get callbacks if this IMPU is removed to terminate call");
527
+		    LM_WARN("Can not get contact from message - will not get callbacks if this IMPU is removed to terminate call\n");
528 528
 			goto send_ccr;
529 529
 		}
530 530
 		
... ...
@@ -532,7 +532,7 @@ static int w_ro_ccr(struct sip_msg *msg, char* c_route_name, char* c_direction,
532 532
 	} else if (dir == RO_TERM_DIRECTION){
533 533
 		//get callee IMPU from called part id - if not present then skip this
534 534
 		if ((identity = cscf_get_public_identity_from_called_party_id(msg, &h)).len == 0) {
535
-			LM_DBG("No P-Called-Identity hdr found - will not get callbacks if this IMPU is removed to terminate call");
535
+			LM_DBG("No P-Called-Identity hdr found - will not get callbacks if this IMPU is removed to terminate call\n");
536 536
 			goto send_ccr;
537 537
 		}
538 538
 		//get callee contact from request URI
... ...
@@ -380,10 +380,10 @@ int get_sip_header_info(struct sip_msg * req,
380 380
 
381 381
     if (get_custom_user(req, asserted_id_uri) == -1) {
382 382
 	    if ((*asserted_id_uri = cscf_get_asserted_identity(req, 0)).len == 0) {
383
-		LM_DBG("No P-Asserted-Identity hdr found. Using From hdr");
383
+		LM_DBG("No P-Asserted-Identity hdr found. Using From hdr\n");
384 384
 
385 385
 		if (!cscf_get_from_uri(req, asserted_id_uri)) {
386
-		    LM_ERR("Error assigning P-Asserted-Identity using From hdr");
386
+		    LM_ERR("Error assigning P-Asserted-Identity using From hdr\n");
387 387
 		    goto error;
388 388
 		}
389 389
 	    }
... ...
@@ -739,7 +739,7 @@ static void resume_on_interim_ccr(int is_timeout, void *param, AAAMessage *cca,
739 739
     }
740 740
 
741 741
     if (ro_cca_data->resultcode != 2001) {
742
-        LM_ERR("Got bad CCA result code [%d] - reservation failed", ro_cca_data->resultcode);
742
+        LM_ERR("Got bad CCA result code [%d] - reservation failed\n", ro_cca_data->resultcode);
743 743
         error_or_timeout = 1;
744 744
         goto error;
745 745
     } else {
... ...
@@ -1073,7 +1073,7 @@ int Ro_Send_CCR(struct sip_msg *msg, struct dlg_cell *dlg, int dir, int reservat
1073 1073
     //getting asserted identity
1074 1074
     if (get_custom_user(msg, &asserted_identity) == -1) {
1075 1075
       if ((asserted_identity = cscf_get_asserted_identity(msg, 0)).len == 0) {
1076
-          LM_DBG("No P-Asserted-Identity hdr found. Using From hdr for asserted_identity");
1076
+          LM_DBG("No P-Asserted-Identity hdr found. Using From hdr for asserted_identity\n");
1077 1077
           asserted_identity = dlg->from_uri;
1078 1078
           if (asserted_identity.len > 0 && asserted_identity.s) {
1079 1079
               p=(char*)memchr(asserted_identity.s, ';',asserted_identity.len);
... ...
@@ -1085,7 +1085,7 @@ int Ro_Send_CCR(struct sip_msg *msg, struct dlg_cell *dlg, int dir, int reservat
1085 1085
 
1086 1086
     //getting called asserted identity
1087 1087
     if ((called_asserted_identity = cscf_get_public_identity_from_called_party_id(msg, &h)).len == 0) {
1088
-        LM_DBG("No P-Called-Identity hdr found. Using request URI for called_asserted_identity");
1088
+        LM_DBG("No P-Called-Identity hdr found. Using request URI for called_asserted_identity\n");
1089 1089
         called_asserted_identity = cscf_get_public_identity_from_requri(msg);
1090 1090
         free_called_asserted_identity = 1;
1091 1091
     }
... ...
@@ -1113,11 +1113,11 @@ int Ro_Send_CCR(struct sip_msg *msg, struct dlg_cell *dlg, int dir, int reservat
1113 1113
 
1114 1114
     str mac = {0, 0};
1115 1115
     if (get_mac_avp_value(msg, &mac) != 0)
1116
-        LM_DBG(RO_MAC_AVP_NAME" was not set. Using default.");
1116
+        LM_DBG(RO_MAC_AVP_NAME" was not set. Using default.\n");
1117 1117
 
1118 1118
     //by default we use voice service id and rate group
1119 1119
     //then we check SDP - if we find video then we use video service id and rate group
1120
-    LM_DBG("Setting default SID to %d and RG to %d for voice",
1120
+    LM_DBG("Setting default SID to %d and RG to %d for voice\n",
1121 1121
             voice_service_identifier, voice_rating_group);
1122 1122
     active_service_identifier = voice_service_identifier;
1123 1123
     active_rating_group = voice_rating_group;
... ...
@@ -1141,7 +1141,7 @@ int Ro_Send_CCR(struct sip_msg *msg, struct dlg_cell *dlg, int dir, int reservat
1141 1141
 
1142 1142
             int intportA = atoi(msg_sdp_stream->port.s);
1143 1143
             if (intportA != 0 && strncasecmp(msg_sdp_stream->media.s, "video", 5) == 0) {
1144
-                LM_DBG("This SDP has a video component and src ports not equal to 0 - so we set default SID to %d and RG to %d for video",
1144
+                LM_DBG("This SDP has a video component and src ports not equal to 0 - so we set default SID to %d and RG to %d for video\n",
1145 1145
                         video_service_identifier, video_rating_group);
1146 1146
                 active_service_identifier = video_service_identifier;
1147 1147
                 active_rating_group = video_rating_group;
... ...
@@ -1342,7 +1342,7 @@ static void resume_on_initial_ccr(int is_timeout, void *param, AAAMessage *cca,
1342 1342
 
1343 1343
 		if (fui_action == AVP_Final_Unit_Action_Redirect) {
1344 1344
 			if (ro_cca_data->mscc->final_unit_action->redirect_server) {
1345
-				LM_DBG("FUI with action: [%d]", ro_cca_data->mscc->final_unit_action->action);
1345
+				LM_DBG("FUI with action: [%d]\n", ro_cca_data->mscc->final_unit_action->action);
1346 1346
 
1347 1347
 				if (ro_cca_data->mscc->final_unit_action->action == AVP_Final_Unit_Action_Redirect) {
1348 1348
 					LM_DBG("Have REDIRECT action with address type of [%d]\n", ro_cca_data->mscc->final_unit_action->redirect_server->address_type);
... ...
@@ -1376,7 +1376,7 @@ static void resume_on_initial_ccr(int is_timeout, void *param, AAAMessage *cca,
1376 1376
             ro_cca_data->mscc->validity_time);
1377 1377
 
1378 1378
     if (ro_cca_data->mscc->granted_service_unit->cc_time <= 0) {
1379
-        LM_DBG("got zero GSU.... reservation failed");
1379
+        LM_DBG("got zero GSU.... reservation failed\n");
1380 1380
         error_code = RO_RETURN_FALSE;
1381 1381
         goto error1;
1382 1382
     }
... ...
@@ -1482,7 +1482,7 @@ static int create_cca_return_code(int result) {
1482 1482
             if (result >= 0)
1483 1483
                 break;
1484 1484
 
1485
-            LM_ERR("Unknown result code: %d", result);
1485
+            LM_ERR("Unknown result code: %d\n", result);
1486 1486
             avp_val.s.s = "??";
1487 1487
     }
1488 1488
 
... ...
@@ -125,7 +125,7 @@ dberror:
125 125
 }
126 126
 
127 127
 int load_ro_info_from_db(int hash_size, int fetch_num_rows) {
128
-    LM_WARN("not supported yet");
128
+    LM_WARN("not supported yet\n");
129 129
     return 0;
130 130
 }
131 131
 
... ...
@@ -22,7 +22,7 @@ struct ro_session_table *ro_session_table = 0;
22 22
 void link_ro_session(struct ro_session *ro_session, int n) {
23 23
     struct ro_session_entry *ro_session_entry;
24 24
     
25
-    LM_DBG("Linking Ro session [%.*s] into entries hash index [%d]", ro_session->ro_session_id.len, ro_session->ro_session_id.s, ro_session->h_entry);
25
+    LM_DBG("Linking Ro session [%.*s] into entries hash index [%d]\n", ro_session->ro_session_id.len, ro_session->ro_session_id.s, ro_session->h_entry);
26 26
 
27 27
     ro_session_entry = &(ro_session_table->entries[ro_session->h_entry]);
28 28
 
... ...
@@ -197,7 +197,7 @@ void destroy_dlg_table(void) {
197 197
 struct ro_session* build_new_ro_session(int direction, int auth_appid, int auth_session_type, str *session_id, str *callid, str *asserted_identity, 
198 198
 	str* called_asserted_identity, str* mac, unsigned int dlg_h_entry, unsigned int dlg_h_id, unsigned int requested_secs, unsigned int validity_timeout,
199 199
 	int active_rating_group, int active_service_identifier, str *incoming_trunk_id, str *outgoing_trunk_id, str *pani){
200
-    LM_DBG("Building Ro Session **********");
200
+    LM_DBG("Building Ro Session **********\n");
201 201
     char *p;
202 202
     unsigned int len = /*session_id->len + */callid->len + asserted_identity->len + called_asserted_identity->len + mac->len + 
203 203
         incoming_trunk_id->len + outgoing_trunk_id->len + pani->len + sizeof (struct ro_session);
... ...
@@ -109,7 +109,7 @@ extern struct ro_session_table *ro_session_table;
109 109
  * \param _entry locked entry
110 110
  */
111 111
 #define ro_session_lock(_table, _entry) \
112
-		{ LM_DBG("LOCKING %d", (_entry)->lock_idx); lock_set_get( (_table)->locks, (_entry)->lock_idx); LM_DBG("LOCKED %d", (_entry)->lock_idx);}
112
+		{ LM_DBG("LOCKING %d\n", (_entry)->lock_idx); lock_set_get( (_table)->locks, (_entry)->lock_idx); LM_DBG("LOCKED %d\n", (_entry)->lock_idx);}
113 113
 
114 114
 
115 115
 /*!
... ...
@@ -118,7 +118,7 @@ extern struct ro_session_table *ro_session_table;
118 118
  * \param _entry locked entry
119 119
  */
120 120
 #define ro_session_unlock(_table, _entry) \
121
-		{ LM_DBG("UNLOCKING %d", (_entry)->lock_idx); lock_set_release( (_table)->locks, (_entry)->lock_idx); LM_DBG("UNLOCKED %d", (_entry)->lock_idx); }
121
+		{ LM_DBG("UNLOCKING %d\n", (_entry)->lock_idx); lock_set_release( (_table)->locks, (_entry)->lock_idx); LM_DBG("UNLOCKED %d\n", (_entry)->lock_idx); }
122 122
 
123 123
 /*!
124 124
  * \brief Reference an ro_session without locking
... ...
@@ -98,12 +98,12 @@ static inline void insert_ro_timer_unsafe(struct ro_tl *tl) {
98 98
     }
99 99
 
100 100
     LM_DBG("inserting %p for %d\n", tl, tl->timeout);
101
-    LM_DBG("BEFORE ptr [%p], ptr->next [%p], ptr->next->prev [%p]", ptr, ptr->next, ptr->next->prev);
101
+    LM_DBG("BEFORE ptr [%p], ptr->next [%p], ptr->next->prev [%p]\n", ptr, ptr->next, ptr->next->prev);
102 102
     tl->prev = ptr;
103 103
     tl->next = ptr->next;
104 104
     tl->prev->next = tl;
105 105
     tl->next->prev = tl;
106
-    LM_DBG("AFTER tl->prev [%p], tl->next [%p]", tl->prev, tl->next);
106
+    LM_DBG("AFTER tl->prev [%p], tl->next [%p]\n", tl->prev, tl->next);
107 107
 }
108 108
 
109 109
 /*!
... ...
@@ -126,7 +126,7 @@ int insert_ro_timer(struct ro_tl *tl, int interval) {
126 126
     insert_ro_timer_unsafe(tl);
127 127
 
128 128
 
129
-    LM_DBG("TIMER inserted");
129
+    LM_DBG("TIMER inserted\n");
130 130
     lock_release(roi_timer->lock);
131 131
 
132 132
     return 0;
... ...
@@ -249,7 +249,7 @@ static inline struct ro_tl* get_expired_ro_sessions(unsigned int time) {
249 249
 void ro_timer_routine(unsigned int ticks, void * attr) {
250 250
 
251 251
     struct ro_tl *tl, *ctl;
252
-    LM_DBG("getting expired ro-sessions");
252
+    LM_DBG("getting expired ro-sessions\n");
253 253
 
254 254
     tl = get_expired_ro_sessions(ticks);
255 255
 
... ...
@@ -275,7 +275,7 @@ void resume_ro_session_ontimeout(struct interim_ccr *i_req, int timeout_or_error
275 275
 
276 276
     ro_session_entry = &(ro_session_table->entries[i_req->ro_session->h_entry]);
277 277
     ro_session_lock(ro_session_table, ro_session_entry);
278
-    LM_DBG("credit=%d credit_valid_for=%d", i_req->new_credit, i_req->credit_valid_for);
278
+    LM_DBG("credit=%d credit_valid_for=%d\n", i_req->new_credit, i_req->credit_valid_for);
279 279
 
280 280
     used_secs = rint((now - ((timeout_or_error==1 && i_req->ro_session->last_event_timestamp_backup>0)?i_req->ro_session->last_event_timestamp_backup : i_req->ro_session->last_event_timestamp)) / (float) 1000000);
281 281
 
... ...
@@ -353,7 +353,7 @@ void resume_ro_session_ontimeout(struct interim_ccr *i_req, int timeout_or_error
353 353
             dlgb.lookup_terminate_dlg(i_req->ro_session->dlg_h_entry, i_req->ro_session->dlg_h_id, NULL);
354 354
             call_terminated = 1;
355 355
         } else {
356
-            LM_DBG("No more credit for user - letting call run out of money in [%i] seconds", whatsleft);
356
+            LM_DBG("No more credit for user - letting call run out of money in [%i] seconds\n", whatsleft);
357 357
             int ret = insert_ro_timer(&i_req->ro_session->ro_tl, whatsleft);
358 358
             if (ret != 0) {
359 359
                 LM_CRIT("unable to insert timer for Ro Session [%.*s]\n",
... ...
@@ -373,7 +373,7 @@ void resume_ro_session_ontimeout(struct interim_ccr *i_req, int timeout_or_error
373 373
     }
374 374
 
375 375
     shm_free(i_req);
376
-    LM_DBG("Exiting async ccr interim nicely");
376
+    LM_DBG("Exiting async ccr interim nicely\n");
377 377
 }
378 378
 
379 379
 /* this is the function called when a we need to request more funds/credit. We need to try and reserve more credit.
... ...
@@ -392,14 +392,14 @@ void ro_session_ontimeout(struct ro_tl *tl) {
392 392
     LM_DBG("offset for ro_tl is [%lu] and ro_session id is [%.*s]\n", (unsigned long) (&((struct ro_session*) 0)->ro_tl), ro_session->ro_session_id.len, ro_session->ro_session_id.s);
393 393
 
394 394
     if (!ro_session) {
395
-        LM_ERR("Can't find a session. This is bad");
395
+        LM_ERR("Can't find a session. This is bad\n");
396 396
         return;
397 397
     }
398 398
 
399
-    LM_DBG("event-type=%d", ro_session->event_type);
399
+    LM_DBG("event-type=%d\n", ro_session->event_type);
400 400
 
401 401
     //	if (!ro_session->active) {
402
-    //		LM_ALERT("Looks like this session was terminated while requesting more units");
402
+    //		LM_ALERT("Looks like this session was terminated while requesting more units\n");
403 403
     //		goto exit;
404 404
     //		return;
405 405
     //	}
... ...
@@ -438,7 +438,7 @@ void ro_session_ontimeout(struct ro_tl *tl) {
438 438
                         ro_session->asserted_identity.len,
439 439
                         ro_session->asserted_identity.s);
440 440
 
441
-                LM_DBG("Call session has been active for %i seconds. The last reserved secs was [%i] and the last event was [%i seconds] ago",
441
+                LM_DBG("Call session has been active for %i seconds. The last reserved secs was [%i] and the last event was [%i seconds] ago\n",
442 442
                         (unsigned int) call_time,
443 443
                         (unsigned int) ro_session->reserved_secs,
444 444
                         (unsigned int) used_secs);