Просмотр исходного кода

mohqueue Remove SVN IDs, add some \n at end of error messages

More cleanup of LM_DBG and LM_ERR needed, as well as code formatting
Olle E. Johansson 10 лет назад
Родитель
Сommit
6daf77d666

+ 1 - 2
modules/mohqueue/mohq.c

@@ -1,9 +1,8 @@
 /*
- * $Id$
  *
  * Copyright (C) 2013 Robert Boisvert
  *
- * This file is part of the mohqueue module for sip-router, a free SIP server.
+ * This file is part of the mohqueue module for Kamailio, a free SIP server.
  *
  * The mohqueue module is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 2 - 4
modules/mohqueue/mohq.h

@@ -1,9 +1,7 @@
 /*
- * $Id$
- *
  * Copyright (C) 2013 Robert Boisvert
  *
- * This file is part of the mohqueue module for sip-router, a free SIP server.
+ * This file is part of the mohqueue module for Kamailio, a free SIP server.
  *
  * The mohqueue module is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -129,4 +127,4 @@ typedef struct
 extern mod_data *pmod_data;
 extern rtpmap prtpmap [];
 
-#endif /* MOHQ_H */
+#endif /* MOHQ_H */

+ 2 - 3
modules/mohqueue/mohq_common.h

@@ -1,9 +1,8 @@
 /*
- * $Id$
  *
  * Copyright (C) 2013 Robert Boisvert
  *
- * This file is part of the mohqueue module for sip-router, a free SIP server.
+ * This file is part of the mohqueue module for Kamailio, a free SIP server.
  *
  * The mohqueue module is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -101,4 +100,4 @@
 #define MOHQ_HEADER_EMPTY( hdr1 ) \
 	((hdr1) == NULL || MOHQ_STR_EMPTY( &(hdr1)->body ))
 
-#endif /* MOHQ_COMMON_H */
+#endif /* MOHQ_COMMON_H */

+ 9 - 11
modules/mohqueue/mohq_db.c

@@ -1,9 +1,7 @@
 /*
- * $Id$
- *
  * Copyright (C) 2013 Robert Boisvert
  *
- * This file is part of the mohqueue module for sip-router, a free SIP server.
+ * This file is part of the mohqueue module for Kamailio, a free SIP server.
  *
  * The mohqueue module is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -297,7 +295,7 @@ db1_con_t *mohq_dbconnect (void)
 str *pdb_url = &pmod_data->pcfg->db_url;
 db1_con_t *pconn = pmod_data->pdb->init (pdb_url);
 if (!pconn)
-  { LM_ERR ("Unable to connect to DB %s", pdb_url->s); }
+  { LM_ERR ("Unable to connect to DB %s\n", pdb_url->s); }
 return pconn;
 }
 
@@ -428,7 +426,7 @@ for (nidx = 0; nidx < MOHQ_COLCNT; nidx++)
 db1_res_t *presult = NULL;
 if (pdb->query (pconn, 0, 0, 0, prkeys, 0, MOHQ_COLCNT, 0, &presult))
   {
-  LM_ERR ("%stable query (%s) failed!", pfncname,
+  LM_ERR ("%stable query (%s) failed!\n", pfncname,
     pmod_data->pcfg->db_qtable.s);
   return;
   }
@@ -449,7 +447,7 @@ for (nidx = 0; nidx < nrows; nidx++)
   struct sip_uri puri_parsed [1];
   if (parse_uri (puri, strlen (puri), puri_parsed))
     {
-    LM_ERR ("Queue,Field (%s,%.*s): %s is not a valid URI!", pqname,
+    LM_ERR ("Queue,Field (%s,%.*s): %s is not a valid URI!\n", pqname,
       STR_FMT (&MOHQCSTR_URI), puri);
     continue;
     }
@@ -477,7 +475,7 @@ for (nidx = 0; nidx < nrows; nidx++)
       struct stat psb [1];
       if (lstat (pmohdir, psb))
         {
-        LM_ERR ("Queue,Field (%s,%.*s): Unable to find %s!", pqname,
+        LM_ERR ("Queue,Field (%s,%.*s): Unable to find %s!\n", pqname,
           STR_FMT (&MOHQCSTR_MDIR), pmohdir);
         continue;
         }
@@ -485,7 +483,7 @@ for (nidx = 0; nidx < nrows; nidx++)
         {
         if ((psb->st_mode & S_IFMT) != S_IFDIR)
           {
-          LM_ERR ("Queue,Field (%s,%.*s): %s is not a directory!", pqname,
+          LM_ERR ("Queue,Field (%s,%.*s): %s is not a directory!\n", pqname,
             STR_FMT (&MOHQCSTR_MDIR), pmohdir);
           continue;
           }
@@ -501,7 +499,7 @@ for (nidx = 0; nidx < nrows; nidx++)
     (char *)VAL_STRING (prowvals + MOHQCOL_MFILE));
   if (!pmohfiles [0])
     {
-    LM_ERR ("Queue,Field (%s,%.*s): Unable to find MOH files (%s/%s.*)!",
+    LM_ERR ("Queue,Field (%s,%.*s): Unable to find MOH files (%s/%s.*)!\n",
       pqname, STR_FMT (&MOHQCSTR_MDIR), pmohdir,
       (char *)VAL_STRING (prowvals + MOHQCOL_MFILE));
     continue;
@@ -576,7 +574,7 @@ for (nidx = 0; nidx < nrows; nidx++)
     pnewlst = (mohq_lst *) shm_malloc (sizeof (mohq_lst) * nsize);
     if (!pnewlst)
       {
-      LM_ERR ("%sUnable to allocate shared memory!", pfncname);
+      LM_ERR ("%sUnable to allocate shared memory!\n", pfncname);
       return;
       }
     pmod_data->mohq_cnt = nsize;
@@ -623,4 +621,4 @@ for (nidx = 0; nidx < pmod_data->mohq_cnt; nidx++)
   --nidx;
   }
 return;
-}
+}

+ 2 - 4
modules/mohqueue/mohq_db.h

@@ -1,9 +1,7 @@
 /*
- * $Id$
- *
  * Copyright (C) 2013 Robert Boisvert
  *
- * This file is part of the mohqueue module for sip-router, a free SIP server.
+ * This file is part of the mohqueue module for Kamailio, a free SIP server.
  *
  * The mohqueue module is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -63,4 +61,4 @@ void update_call_rec (call_lst *);
 void update_debug (mohq_lst *, int);
 void update_mohq_lst (db1_con_t *pconn);
 
-#endif /* MOHQ_DB_H */
+#endif /* MOHQ_DB_H */

+ 30 - 32
modules/mohqueue/mohq_funcs.c

@@ -1,9 +1,7 @@
 /*
- * $Id$
- *
  * Copyright (C) 2013 Robert Boisvert
  *
- * This file is part of the mohqueue module for sip-router, a free SIP server.
+ * This file is part of the mohqueue module for Kamailio, a free SIP server.
  *
  * The mohqueue module is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -195,10 +193,10 @@ if (pcall->call_state != CLSTA_INVITED)
   **********/
 
   if (pcall->call_state != CLSTA_INQUEUE)
-    { LM_ERR ("%sUnexpected ACK (%s)!", pfncname, pcall->call_from); }
+    { LM_ERR ("%sUnexpected ACK (%s)!\n", pfncname, pcall->call_from); }
   else
     {
-    mohq_debug (pcall->pmohq, "%sACK from refused re-INVITE (%s)!",
+    mohq_debug (pcall->pmohq, "%sACK from refused re-INVITE (%s)!\n",
       pfncname, pcall->call_from);
     }
   return 1;
@@ -212,7 +210,7 @@ if (pcall->call_state != CLSTA_INVITED)
 
 if (ptm->t_lookup_ident (&ptrans, pcall->call_hash, pcall->call_label) < 0)
   {
-  LM_ERR ("%sINVITE transaction missing for call (%s)!",
+  LM_ERR ("%sINVITE transaction missing for call (%s)!\n",
     pfncname, pcall->call_from);
   return 1;
   }
@@ -220,7 +218,7 @@ else
   {
   if (ptm->t_release (pcall->call_pmsg) < 0)
     {
-    LM_ERR ("%sRelease transaction failed for call (%s)!",
+    LM_ERR ("%sRelease transaction failed for call (%s)!\n",
       pfncname, pcall->call_from);
     return 1;
     }
@@ -261,7 +259,7 @@ char *pfncname = "bye_cb: ";
 call_lst *pcall = (call_lst *)*pcbp->param;
 if (ntype == TMCB_ON_FAILURE)
   {
-  LM_ERR ("%sCall (%s) did not respond to BYE", pfncname,
+  LM_ERR ("%sCall (%s) did not respond to BYE\n", pfncname,
     pcall->call_from);
   }
 else
@@ -269,7 +267,7 @@ else
   int nreply = pcbp->code;
   if ((nreply / 100) != 2)
     {
-    LM_ERR ("%sCall (%s) BYE error (%d)", pfncname,
+    LM_ERR ("%sCall (%s) BYE error (%d)\n", pfncname,
       pcall->call_from, nreply);
     }
   else
@@ -302,7 +300,7 @@ int bye_msg (sip_msg_t *pmsg, call_lst *pcall)
 char *pfncname = "bye_msg: ";
 if (pmod_data->psl->freply (pmsg, 200, presp_ok) < 0)
   {
-  LM_ERR ("%sUnable to create reply to call (%s)", pfncname,
+  LM_ERR ("%sUnable to create reply to call (%s)\n", pfncname,
     pcall->call_from);
   return 1;
   }
@@ -310,7 +308,7 @@ if (pcall->call_state >= CLSTA_INQUEUE)
   { drop_call (pmsg, pcall); }
 else
   {
-  LM_ERR ("%sEnding call (%s) before placed in queue!",
+  LM_ERR ("%sEnding call (%s) before placed in queue!\n",
     pfncname, pcall->call_from);
   delete_call (pcall);
   }
@@ -340,14 +338,14 @@ if (pcall->call_state < CLSTA_INQUEUE)
   mohq_debug (pcall->pmohq, "%sCANCELed call (%s)",
     pfncname, pcall->call_from);
   if (pmod_data->psl->freply (pmsg, 487, presp_reqterm) < 0)
-    { LM_ERR ("%sUnable to create reply!", pfncname); }
+    { LM_ERR ("%sUnable to create reply!\n", pfncname); }
   }
 else
   {
-  LM_ERR ("%sUnable to CANCEL because accepted INVITE for call (%s)!",
+  LM_ERR ("%sUnable to CANCEL because accepted INVITE for call (%s)!\n",
     pfncname, pcall->call_from);
   if (pmod_data->psl->freply (pmsg, 481, presp_nocall) < 0)
-    { LM_ERR ("%sUnable to create reply!", pfncname); }
+    { LM_ERR ("%sUnable to create reply!\n", pfncname); }
   }
 return 1;
 }
@@ -378,7 +376,7 @@ if (pmsg != FAKED_REPLY)
     pfncname, pcall->call_from);
   if (pmod_data->fn_rtp_destroy (pmsg, 0, 0) != 1)
     {
-    LM_ERR ("%srtpproxy_destroy refused for call (%s)!",
+    LM_ERR ("%srtpproxy_destroy refused for call (%s)!\n",
       pfncname, pcall->call_from);
     }
   }
@@ -402,7 +400,7 @@ int npos1 = sizeof (pbyemsg) // BYE template
 phdr = pkg_malloc (npos1);
 if (!phdr)
   {
-  LM_ERR ("%sNo more memory!", pfncname);
+  LM_ERR ("%sNo more memory!\n", pfncname);
   goto bye_err;
   }
 sprintf (phdr, pbyemsg,
@@ -422,11 +420,11 @@ set_uac_req (puac, pbye, phdrs, 0, pdlg,
 pcall->call_state = CLSTA_BYE;
 if (ptm->t_request_within (puac) < 0)
   {
-  LM_ERR ("%sUnable to create BYE request for call (%s)!",
+  LM_ERR ("%sUnable to create BYE request for call (%s)!\n",
     pfncname, pcall->call_from);
   goto bye_err;
   }
-mohq_debug (pcall->pmohq, "%sSent BYE request for call (%s)",
+mohq_debug (pcall->pmohq, "%sSent BYE request for call (%s)\n",
   pfncname, pcall->call_from);
 bsent = 1;
 
@@ -466,7 +464,7 @@ int create_call (int mohq_idx, sip_msg_t *pmsg)
 char *pfncname = "create_call: ";
 if (!mohq_lock_set (pmod_data->pcall_lock, 1, 2000))
   {
-  LM_ERR ("%sUnable to lock calls!", pfncname);
+  LM_ERR ("%sUnable to lock calls!\n", pfncname);
   return -1;
   }
 call_lst *pcall;
@@ -474,7 +472,7 @@ int ncall_idx = find_call (pmsg, &pcall);
 if (pcall)
   {
   mohq_lock_release (pmod_data->pcall_lock);
-  LM_ERR ("%sCall already in use (%s)!", pfncname, pcall->call_from);
+  LM_ERR ("%sCall already in use (%s)!\n", pfncname, pcall->call_from);
   return -1;
   }
 for (ncall_idx = 0; ncall_idx < pmod_data->call_cnt; ncall_idx++)
@@ -485,7 +483,7 @@ for (ncall_idx = 0; ncall_idx < pmod_data->call_cnt; ncall_idx++)
 if (ncall_idx == pmod_data->call_cnt)
   {
   mohq_lock_release (pmod_data->pcall_lock);
-  LM_ERR ("%sNo call slots available!", pfncname);
+  LM_ERR ("%sNo call slots available!\n", pfncname);
   return -1;
   }
 
@@ -605,14 +603,14 @@ if (pcall->call_hash || pcall->call_label)
   {
   if (ptm->t_lookup_ident (&ptrans, pcall->call_hash, pcall->call_label) < 0)
     {
-    LM_ERR ("%sLookup transaction failed for call (%s)!", pfncname,
+    LM_ERR ("%sLookup transaction failed for call (%s)!\n", pfncname,
       pcall->call_from);
     }
   else
     {
     if (ptm->t_release (pcall->call_pmsg) < 0)
       {
-      LM_ERR ("%sRelease transaction failed for call (%s)!",
+      LM_ERR ("%sRelease transaction failed for call (%s)!\n",
         pfncname, pcall->call_from);
       }
     }
@@ -655,21 +653,21 @@ char *pfncname = "deny_method: ";
 tm_api_t *ptm = pmod_data->ptm;
 if (ptm->t_newtran (pmsg) < 0)
   {
-  LM_ERR ("%sUnable to create new transaction!", pfncname);
+  LM_ERR ("%sUnable to create new transaction!\n", pfncname);
   if (pmod_data->psl->freply (pmsg, 500, presp_srverr) < 0)
     {
-    LM_ERR ("%sUnable to create reply to %.*s!", pfncname,
+    LM_ERR ("%sUnable to create reply to %.*s!\n", pfncname,
       STR_FMT (&REQ_LINE (pmsg).method));
     }
   return;
   }
 if (!add_lump_rpl2 (pmsg, pallowhdr->s, pallowhdr->len, LUMP_RPL_HDR))
-  { LM_ERR ("%sUnable to add Allow header!", pfncname); }
+  { LM_ERR ("%sUnable to add Allow header!\n", pfncname); }
 LM_ERR ("%sRefused %.*s for call (%s)!", pfncname,
   STR_FMT (&REQ_LINE (pmsg).method), pcall->call_from);
 if (ptm->t_reply (pmsg, 405, presp_noallow->s) < 0)
   {
-  LM_ERR ("%sUnable to create reply to %.*s!", pfncname,
+  LM_ERR ("%sUnable to create reply to %.*s!\n", pfncname,
     STR_FMT (&REQ_LINE (pmsg).method));
   }
 return;
@@ -699,7 +697,7 @@ if (pmsg != FAKED_REPLY)
     pfncname, pcall->call_from);
   if (pmod_data->fn_rtp_destroy (pmsg, 0, 0) != 1)
     {
-    LM_ERR ("%srtpproxy_destroy refused for call (%s)!",
+    LM_ERR ("%srtpproxy_destroy refused for call (%s)!\n",
       pfncname, pcall->call_from);
     }
   }
@@ -785,7 +783,7 @@ for (nidx = 0; nidx < pmod_data->call_cnt; nidx++)
     {
     if ((pcall->call_time + 32) < time (0))
       {
-      LM_ERR ("find_call: No ACK response for call (%s)", pcall->call_from);
+      LM_ERR ("find_call: No ACK response for call (%s)\n", pcall->call_from);
       delete_call (pcall);
       continue;
       }
@@ -831,7 +829,7 @@ int nidx;
 str tmpstr;
 if (!mohq_lock_set (pmod_data->pmohq_lock, 0, 500))
   {
-  LM_ERR ("%sUnable to lock queues!", pfncname);
+  LM_ERR ("%sUnable to lock queues!\n", pfncname);
   return -1;
   }
 for (nidx = 0; nidx < pmod_data->mohq_cnt; nidx++)
@@ -843,7 +841,7 @@ for (nidx = 0; nidx < pmod_data->mohq_cnt; nidx++)
   }
 if (nidx == pmod_data->mohq_cnt)
   {
-  LM_ERR ("%sUnable to find queue (%.*s)!", pfncname, STR_FMT (pqname));
+  LM_ERR ("%sUnable to find queue (%.*s)!\n", pfncname, STR_FMT (pqname));
   nidx = -1;
   }
 mohq_lock_release (pmod_data->pmohq_lock);
@@ -2662,4 +2660,4 @@ if (pmod_data->ptm->t_relay (pmsg, 0, 0) < 0)
   return -1;
   }
 return 1;
-}
+}

+ 2 - 4
modules/mohqueue/mohq_funcs.h

@@ -1,9 +1,7 @@
 /*
- * $Id$
- *
  * Copyright (C) 2013 Robert Boisvert
  *
- * This file is part of the mohqueue module for sip-router, a free SIP server.
+ * This file is part of the mohqueue module for Kamailio, a free SIP server.
  *
  * The mohqueue module is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -37,4 +35,4 @@ int mohq_process (sip_msg_t *);
 int mohq_retrieve (sip_msg_t *, char *, char *);
 int mohq_send (sip_msg_t *, char *);
 
-#endif /* MOHQ_FUNCS_H */
+#endif /* MOHQ_FUNCS_H */

+ 2 - 4
modules/mohqueue/mohq_locks.c

@@ -1,9 +1,7 @@
 /*
- * $Id$
- *
  * Copyright (C) 2013 Robert Boisvert
  *
- * This file is part of the mohqueue module for sip-router, a free SIP server.
+ * This file is part of the mohqueue module for Kamailio, a free SIP server.
  *
  * The mohqueue module is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -196,4 +194,4 @@ do
   }
 while (!nret && --nms_cnt >= 0);
 return nret;
-}
+}

+ 2 - 4
modules/mohqueue/mohq_locks.h

@@ -1,9 +1,7 @@
 /*
- * $Id$
- *
  * Copyright (C) 2013 Robert Boisvert
  *
- * This file is part of the mohqueue module for sip-router, a free SIP server.
+ * This file is part of the mohqueue module for Kamailio, a free SIP server.
  *
  * The mohqueue module is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -46,4 +44,4 @@ int mohq_lock_init (mohq_lock *);
 void mohq_lock_release (mohq_lock *);
 int mohq_lock_set (mohq_lock *, int, int);
 
-#endif /* MOHQ_LOCKS_H */
+#endif /* MOHQ_LOCKS_H */