Browse Source

modules/mohqueue: pull changes from upstream

Merges up to upstream commit a3f679430d853d5b1b71ba92d8547ca2c86509ec.

Changes in code:
* fixes RTP stop not being sent
* use pcbp->req instead of -> in rtp_destroy
* fixed uninitialized varbs
* use close_call () for no response on INVITE
* changed to return handled if reINVITE sent
* switched to using fixup_svpe functions

Documentation:
* added comment about rtpproxy limit
* adjusted to remove hold sequence in transfer out
Robert Boisvert 12 years ago
parent
commit
753e93d3ad

+ 7 - 9
modules/mohqueue/doc/mohqueue_admin.xml

@@ -19,14 +19,12 @@ The mohqueue module diverts INVITE requests into a
 <ulink url="http://en.wikipedia.org/wiki/Music_on_hold">Music On
 Hold (MOH)</ulink> queue where the caller can listen to recorded
 audio until an operator is available to take the call. When an
-operator is available, a function can be used to put the oldest
-call for a queue on hold, disable the audio stream, and initiate
-an unattended transfer to a specified URI using a REFER command.
-If successful, the call is removed from the queue. If the transfer
-fails, the hold is turned off and the audio stream is reenabled.
+operator is available, a function can be used to transfer the oldest
+call in a queue to an operator using an unattended transfer (REFER)
+to a specified URI. If successful, the call is removed from the queue.
     </para>
     <para>
-While in queue, recorded audio is streamed to the caller in an
+While in queue, recorded audio is streamed to the caller in an endless
 loop using the rtpproxy module and application. Each queue can be
 configured to use different audio files.
     </para>
@@ -145,7 +143,8 @@ modparam ("mohqueue", "mohdir", "/var/kamailio/MOH")
 Defines the maximum number of calls that can be placed in queue.
 It is the sum of all calls in all queues. It must be in the range
 of 1 to 5000. <emphasis>NOTE:</emphasis> it may be limited by the
-processing power of the server.
+processing power of the server or the number of available rtpproxy
+ports.
       </para>
       <para>
 <emphasis>None. If not set by the module it must be defined in the
@@ -187,8 +186,7 @@ header field along with the RURI to find a match, except in the case
 of a CANCEL which matches only on the RURI.
       </para>
       <para>
-This function has no parameters and must be called from the main
-(request) route.
+This function has no parameters and must be called from a request route.
       </para>
       <para>
 <emphasis>Return code:</emphasis>

+ 5 - 36
modules/mohqueue/mohq.c

@@ -38,7 +38,6 @@ int fixup_count (void **, int);
 static int mod_child_init (int);
 static void mod_destroy (void);
 static int mod_init (void);
-int str_fixup (void **, int);
 
 /**********
 * global varbs
@@ -55,9 +54,9 @@ static cmd_export_t mod_cmds [] = {
   { "mohq_count", (cmd_function) mohq_count, 2, fixup_count, 0,
     REQUEST_ROUTE | FAILURE_ROUTE | ONREPLY_ROUTE },
   { "mohq_process", (cmd_function) mohq_process, 0, NULL, 0, REQUEST_ROUTE },
-  { "mohq_retrieve", (cmd_function) mohq_retrieve, 2, str_fixup, 0,
+  { "mohq_retrieve", (cmd_function) mohq_retrieve, 2, fixup_spve_spve, 0,
     REQUEST_ROUTE | FAILURE_ROUTE | ONREPLY_ROUTE },
-  { "mohq_send", (cmd_function) mohq_send, 1, str_fixup, 0, REQUEST_ROUTE },
+  { "mohq_send", (cmd_function) mohq_send, 1, fixup_spve_spve, 0, REQUEST_ROUTE },
   { NULL, NULL, -1, 0, 0 },
 };
 
@@ -117,7 +116,9 @@ int fixup_count (void **param, int param_no)
 
 {
 if (param_no == 1)
-  { return str_fixup (param, param_no); }
+  { return fixup_spve_spve (param, 1); }
+if (param_no == 2)
+  { return fixup_pvar_null (param, 1); }
 return 0;
 }
 
@@ -408,12 +409,6 @@ if (!pmod_data->fn_rtp_stream_s)
   LM_ERR ("Unable to load rtpproxy_stream2uas");
   goto initerr;
   }
-pmod_data->fn_rtp_stop_stream = find_export ("rtpproxy_stop_stream2uas", 0, 0);
-if (!pmod_data->fn_rtp_stop_stream)
-  {
-  LM_ERR ("Unable to load rtpproxy_stop_stream2uas");
-  goto initerr;
-  }
 pmod_data->fn_rtp_destroy = find_export ("rtpproxy_destroy", 0, 0);
 if (!pmod_data->fn_rtp_destroy)
   {
@@ -444,30 +439,4 @@ if (pmod_data->pcall_lock->plock)
 shm_free (pmod_data);
 pmod_data = NULL;
 return -1;
-}
-
-/**********
-* String Fixup
-*
-* INPUT:
-*   Arg (1) = parameter array pointer
-*   Arg (1) = parameter number
-* OUTPUT: -1 if failed; 0 if saved as pv_elem_t
-**********/
-
-int str_fixup (void **param, int param_no)
-
-{
-pv_elem_t *ppv = NULL;
-str pstr [1];
-
-pstr->s = (char *)(*param);
-pstr->len = strlen (pstr->s);
-if (pv_parse_format (pstr, &ppv) < 0)
-  {
-  LM_ERR ("Invalid string format (%s)", pstr->s);
-  return E_UNSPEC;
-  }
-*param = (void*)ppv;
-return 0;
 }

+ 2 - 5
modules/mohqueue/mohq.h

@@ -69,10 +69,8 @@ typedef struct
 #define CLSTA_INVITED   104
 #define CLSTA_CANCEL    105
 #define CLSTA_INQUEUE   200
-#define CLSTA_HLDSTRT   301
-#define CLSTA_REFER     302
-#define CLSTA_RFRWAIT   303
-#define CLSTA_NHLDSTRT  304
+#define CLSTA_REFER     301
+#define CLSTA_RFRWAIT   302
 #define CLSTA_BYE       305
 
 typedef struct
@@ -122,7 +120,6 @@ typedef struct
   cmd_function fn_rtp_offer;
   cmd_function fn_rtp_stream_c;
   cmd_function fn_rtp_stream_s;
-  cmd_function fn_rtp_stop_stream;
   } mod_data;
 
 /**********

+ 2 - 0
modules/mohqueue/mohq_common.h

@@ -36,6 +36,8 @@
 #include "../../flags.h"
 #include "../../hashes.h"
 #include "../../locking.h"
+#include "../../lvalue.h"
+#include "../../mod_fix.h"
 #include "../../sr_module.h"
 #include "../../str.h"
 

+ 55 - 282
modules/mohqueue/mohq_funcs.c

@@ -155,9 +155,8 @@ void delete_call (call_lst *);
 void drop_call (sip_msg_t *, call_lst *);
 dlg_t *form_dialog (call_lst *, struct to_body *);
 int form_rtp_SDP (str *, call_lst *, char *);
-static void hold_cb (struct cell *, int, struct tmcb_params *);
 static void invite_cb (struct cell *, int, struct tmcb_params *);
-int refer_call (call_lst *);
+int refer_call (call_lst *, mohq_lock *);
 static void refer_cb (struct cell *, int, struct tmcb_params *);
 int send_prov_rsp (sip_msg_t *, call_lst *);
 int send_rtp_answer (sip_msg_t *, call_lst *);
@@ -295,8 +294,7 @@ int bye_msg (sip_msg_t *pmsg, call_lst *pcall)
 {
 /**********
 * o send OK
-* o destroy proxy
-* o teardown queue
+* o teardown call
 **********/
 
 char *pfncname = "bye_msg: ";
@@ -359,113 +357,6 @@ else
 return 1;
 }
 
-/**********
-* Change Hold
-*
-* INPUT:
-*   Arg (1) = call pointer
-*   Arg (2) = hold flag
-* OUTPUT: 0 if failed
-**********/
-
-int change_hold (call_lst *pcall, int bhold)
-
-{
-/**********
-* create dialog
-**********/
-
-char *pfncname = "change_hold: ";
-tm_api_t *ptm = pmod_data->ptm;
-int nret = 0;
-struct to_body ptob [2];
-dlg_t *pdlg = form_dialog (pcall, ptob);
-if (!pdlg)
-  { return 0; }
-
-/**********
-* form re-INVITE header
-* o calculate size
-* o create buffer
-**********/
-
-char *pquri = pcall->pmohq->mohq_uri;
-int npos1 = sizeof (preinvitemsg) // re-INVITE template
-  + strlen (pcall->call_via) // Via
-  + strlen (pquri); // Contact
-char *psdp = 0;
-char *phdr = pkg_malloc (npos1);
-if (!phdr)
-  {
-  LM_ERR ("%sNo more memory!", pfncname);
-  goto hold_err;
-  }
-sprintf (phdr, preinvitemsg,
-  pcall->call_via, // Via
-  pquri); // Contact
-str phdrs [1];
-phdrs->s = phdr;
-phdrs->len = strlen (phdr);
-
-/**********
-* form re-INVITE body
-* o calculate size
-* o create buffer
-**********/
-
-npos1 = sizeof (pinvitesdp) // re-INVITE template
-  + strlen (pcall->call_addr) * 2 // server IP address twice
-  + 29;  // session id + version, send type, media port number
-psdp = pkg_malloc (npos1);
-if (!psdp)
-  {
-  LM_ERR ("%sNo more memory!", pfncname);
-  goto hold_err;
-  }
-sprintf (psdp, pinvitesdp,
-  time (0), time (0) + 1, // session id + version
-  pcall->call_addr, pcall->call_addr, // server IP address
-  bhold ? "only" : "recv", // hold type
-  pcall->call_aport); // audio port
-str pbody [1];
-if (!form_rtp_SDP (pbody, pcall, psdp))
-  { goto hold_err; }
-pkg_free (psdp);
-psdp = pbody->s;
-
-/**********
-* send re-INVITE request
-**********/
-
-uac_req_t puac [1];
-set_uac_req (puac, pinvite, phdrs, pbody, pdlg,
-  TMCB_LOCAL_COMPLETED | TMCB_ON_FAILURE, hold_cb, pcall);
-pcall->call_state = bhold ? CLSTA_HLDSTRT : CLSTA_NHLDSTRT;
-if (ptm->t_request_within (puac) < 0)
-  {
-  LM_ERR ("%sUnable to create re-INVITE request for call (%s)!",
-    pfncname, pcall->call_from);
-  }
-else
-  {
-  nret = 1;
-  mohq_debug (pcall->pmohq, "%sSent re-INVITE request for call (%s)",
-    pfncname, pcall->call_from);
-  }
-
-/**********
-* release memory
-**********/
-
-hold_err:
-if (pdlg)
-  { pkg_free (pdlg); }
-if (psdp)
-  { pkg_free (psdp); }
-pkg_free (phdr);
-return nret;
-}
-
 /**********
 * Close the Call
 *
@@ -484,8 +375,12 @@ void close_call (sip_msg_t *pmsg, call_lst *pcall)
 **********/
 
 char *pfncname = "close_call: ";
+int bsent = 0;
+char *phdr = 0;
 if (pmsg != FAKED_REPLY)
   {
+  mohq_debug (pcall->pmohq, "%sDestroying RTP link for call (%s)",
+    pfncname, pcall->call_from);
   if (pmod_data->fn_rtp_destroy (pmsg, 0, 0) != 1)
     {
     LM_ERR ("%srtpproxy_destroy refused for call (%s)!",
@@ -505,8 +400,6 @@ pdlg->state = DLG_CONFIRMED;
 **********/
 
 tm_api_t *ptm = pmod_data->ptm;
-char *phdr = 0;
-int bsent = 0;
 char *pquri = pcall->pmohq->mohq_uri;
 int npos1 = sizeof (pbyemsg) // BYE template
   + strlen (pcall->call_via) // Via
@@ -776,6 +669,8 @@ void drop_call (sip_msg_t *pmsg, call_lst *pcall)
 char *pfncname = "drop_call: ";
 if (pmsg != FAKED_REPLY)
   {
+  mohq_debug (pcall->pmohq, "%sDestroying RTP link for call (%s)",
+    pfncname, pcall->call_from);
   if (pmod_data->fn_rtp_destroy (pmsg, 0, 0) != 1)
     {
     LM_ERR ("%srtpproxy_destroy refused for call (%s)!",
@@ -1016,6 +911,8 @@ if (!(pmsg->msg_flags & FL_SDP_BODY))
     return 0;
     }
   }
+LM_DBG ("%sMaking offer for RTP link for call (%.*s)",
+  pfncname, STR_FMT (&pmsg->callid->body));
 if (pmod_data->fn_rtp_offer (pmsg, 0, 0) != 1)
   {
   LM_ERR ("%srtpproxy_offer refused for call (%.*s)!",
@@ -1292,109 +1189,6 @@ pstr->len = nsize;
 return 1;
 }
 
-/**********
-* Hold Callback
-*
-* INPUT:
-*   Arg (1) = cell pointer
-*   Arg (2) = callback type
-*   Arg (3) = callback parms
-* OUTPUT: none
-**********/
-
-static void
-  hold_cb (struct cell *ptrans, int ntype, struct tmcb_params *pcbp)
-
-{
-char *pfncname = "hold_cb: ";
-call_lst *pcall = (call_lst *)*pcbp->param;
-int nreply;
-if (pcbp->rpl == FAKED_REPLY)
-  { ntype = TMCB_ON_FAILURE; }
-switch (ntype)
-  {
-  case TMCB_ON_FAILURE:
-    /**********
-    * drop call
-    **********/
-
-    LM_ERR ("%sHold failed for call (%s)!", pfncname, pcall->call_from);
-    drop_call (pcbp->rpl, pcall);
-    return;
-    break;
-  case TMCB_LOCAL_COMPLETED:
-    /**********
-    * check reply status
-    **********/
-
-    nreply = pcbp->rpl->first_line.u.reply.statuscode;
-    if ((nreply / 100) != 2)
-      {
-      LM_ERR ("%sCall (%s) hold error (%d)", pfncname,
-        pcall->call_from, nreply);
-      if ((nreply == 481) || (nreply == 487))
-        {
-        drop_call (pcbp->rpl, pcall);
-        return;
-        }
-      }
-    else
-      {
-      mohq_debug (pcall->pmohq, "%sCall (%s) hold reply=%d",
-        pfncname, pcall->call_from, nreply);
-      }
-    break;
-  }
-
-/**********
-* o send RTP offer
-* o hold off?
-**********/
-
-if (pmod_data->fn_rtp_offer (pcbp->rpl, 0, 0) != 1)
-  {
-  LM_ERR ("%srtpproxy_offer refused for call (%s)!",
-    pfncname, pcall->call_from);
-  drop_call (pcbp->rpl, pcall);
-  return;
-  }
-if (pcall->call_state == CLSTA_NHLDSTRT)
-  {
-  /**********
-  * o return call to queue
-  * o start streaming
-  **********/
-
-  pcall->call_state = CLSTA_INQUEUE;
-  update_call_rec (pcall);
-  start_stream (pcbp->rpl, pcall, 1);
-  return;
-  }
-
-/**********
-* o stop streaming
-* o send refer
-* o take call off hold
-**********/
-
-if (pmod_data->fn_rtp_stop_stream (pcbp->rpl, 0, 0) != 1)
-  {
-  LM_ERR ("%srtpproxy_stop_stream refused for call (%s)!",
-    pfncname, pcall->call_from);
-  drop_call (pcbp->rpl, pcall);
-  return;
-  }
-if (refer_call (pcall))
-  { return; }
-LM_ERR ("%sUnable to refer call (%s)!", pfncname, pcall->call_from);
-if (!change_hold (pcall, 0))
-  {
-  pcall->call_state = CLSTA_INQUEUE;
-  update_call_rec (pcall);
-  }
-return;
-}
-
 /**********
 * Invite Callback
 *
@@ -1420,7 +1214,7 @@ switch (pcall->call_state)
     break;
   case CLSTA_INVITED:
     LM_ERR ("%sINVITE failed for call (%s)!", pfncname, pcall->call_from);
-    drop_call (pcbp->rpl, pcall);
+    close_call (FAKED_REPLY, pcall);
     break;
   }
 }
@@ -1521,7 +1315,7 @@ switch (nreply / 100)
     close_call (pmsg, pcall);
     break;
   default:
-    LM_ERR ("%sUnable to redirect call (%s)!", pfncname, pcall->call_from);
+    LM_WARN ("%sUnable to redirect call (%s)!", pfncname, pcall->call_from);
     if (nreply == 487)
       {
       /**********
@@ -1531,11 +1325,13 @@ switch (nreply / 100)
       drop_call (pmsg, pcall);
       return 0;
       }
-    if (!change_hold (pcall, 0))
-      {
-      pcall->call_state = CLSTA_INQUEUE;
-      update_call_rec (pcall);
-      }
+
+    /**********
+    * return call to queue
+    **********/
+
+    pcall->call_state = CLSTA_INQUEUE;
+    update_call_rec (pcall);
     break;
   }
 return 1;
@@ -1595,10 +1391,11 @@ return 1;
 *
 * INPUT:
 *   Arg (1) = call pointer
+*   Arg (2) = lock pointer
 * OUTPUT: 0 if failed
 **********/
 
-int refer_call (call_lst *pcall)
+int refer_call (call_lst *pcall, mohq_lock *plock)
 
 {
 /**********
@@ -1609,7 +1406,10 @@ char *pfncname = "refer_call: ";
 struct to_body ptob [2];
 dlg_t *pdlg = form_dialog (pcall, ptob);
 if (!pdlg)
-  { return 0; }
+  {
+  mohq_lock_release (plock);
+  return 0;
+  }
 pdlg->state = DLG_CONFIRMED;
 
 /**********
@@ -1650,6 +1450,7 @@ set_uac_req (puac, prefer, phdrs, 0, pdlg,
   TMCB_LOCAL_COMPLETED | TMCB_ON_FAILURE, refer_cb, pcall);
 pcall->call_state = CLSTA_REFER;
 update_call_rec (pcall);
+mohq_lock_release (plock);
 if (ptm->t_request_within (puac) < 0)
   {
   pcall->call_state = CLSTA_INQUEUE;
@@ -1685,11 +1486,11 @@ static void refer_cb
 {
 char *pfncname = "refer_cb: ";
 call_lst *pcall = (call_lst *)*pcbp->param;
-if ((ntype == TMCB_ON_FAILURE) || (pcbp->rpl == FAKED_REPLY))
+if ((ntype == TMCB_ON_FAILURE) || (pcbp->req == FAKED_REPLY))
   {
   LM_ERR ("%sCall (%s) did not respond to REFER", pfncname,
     pcall->call_from);
-  drop_call (pcbp->rpl, pcall);
+  drop_call (pcbp->req, pcall);
   return;
   }
 int nreply = pcbp->rpl->first_line.u.reply.statuscode;
@@ -1734,7 +1535,7 @@ if ((pcall->call_state / 100) < 2)
     pfncname, pcall->call_from);
   if (pmod_data->psl->freply (pmsg, 491, presp_reqpend) < 0)
     { LM_ERR ("%sUnable to create reply!", pfncname); }
-  return 0;
+  return 1;
   }
 if (!(pmsg->msg_flags & FL_SDP_BODY))
   {
@@ -1743,7 +1544,7 @@ if (!(pmsg->msg_flags & FL_SDP_BODY))
     LM_ERR ("%sre-INVITE lacks SDP (%s)!", pfncname, pcall->call_from);
     if (pmod_data->psl->freply (pmsg, 488, presp_noaccept) < 0)
       { LM_ERR ("%sUnable to create reply!", pfncname); }
-    return 0;
+    return 1;
     }
   }
 
@@ -1818,7 +1619,7 @@ if (!bhold)
     if (pmod_data->psl->freply (pmsg, 488, presp_noaccept) < 0)
       {
       LM_ERR ("%sUnable to create reply!", pfncname);
-      return 0;
+      return 1;
       }
     }
   else
@@ -1828,7 +1629,7 @@ if (!bhold)
     if (pmod_data->psl->freply (pmsg, 200, presp_ok) < 0)
       {
       LM_ERR ("%sUnable to create reply!", pfncname);
-      return 0;
+      return 1;
       }
     }
   return 1;
@@ -1843,7 +1644,7 @@ LM_ERR ("%sTerminating call (%s) because hold not allowed!",
 if (pmod_data->psl->freply (pmsg, 200, presp_ok) < 0)
   {
   LM_ERR ("%sUnable to create reply!", pfncname);
-  return 0;
+  return 1;
   }
 close_call (pmsg, pcall);
 return 1;
@@ -2098,6 +1899,8 @@ memcpy (&pnmsg->rcv, &pmsg->rcv, sizeof (struct receive_info));
 * o send stream
 **********/
 
+mohq_debug (pcall->pmohq, "%sAnswering RTP link for call (%s)",
+  pfncname, pcall->call_from);
 if (pmod_data->fn_rtp_answer (pnmsg, 0, 0) != 1)
   {
   LM_ERR ("%srtpproxy_answer refused for call (%s)!",
@@ -2193,6 +1996,7 @@ return nret;
 int start_stream (sip_msg_t *pmsg, call_lst *pcall, int bserver)
 
 {
+char *pfncname = "start_stream: ";
 char pfile [MOHDIRLEN + MOHFILELEN + 2];
 strcpy (pfile, pcall->pmohq->mohq_mohdir);
 int npos = strlen (pfile);
@@ -2204,10 +2008,12 @@ pv_elem_t *pmodel;
 pv_parse_format (pMOH, &pmodel);
 cmd_function fn_stream = bserver ? pmod_data->fn_rtp_stream_s
   : pmod_data->fn_rtp_stream_c;
+mohq_debug (pcall->pmohq, "%sStarting RTP link for call (%s)",
+  pfncname, pcall->call_from);
 if (fn_stream (pmsg, (char *)pmodel, (char *)-1) != 1)
   {
-  LM_ERR ("start_stream: rtpproxy_stream refused for call (%s)!",
-    pcall->call_from);
+  LM_ERR ("%srtpproxy_stream refused for call (%s)!",
+    pfncname, pcall->call_from);
   return 0;
   }
 return 1;
@@ -2431,7 +2237,7 @@ return init_mi_tree (200, MI_OK_S, MI_OK_LEN);
 * OUTPUT: -1 if no items in queue; else result = count
 **********/
 
-int mohq_count (sip_msg_t *pmsg, pv_elem_t *pqueue, char *presult)
+int mohq_count (sip_msg_t *pmsg, char *pqueue, pv_spec_t *presult)
 
 {
 /**********
@@ -2439,34 +2245,15 @@ int mohq_count (sip_msg_t *pmsg, pv_elem_t *pqueue, char *presult)
 **********/
 
 char *pfncname = "mohq_count: ";
-str pavp [1], pqname [1];
+str pqname [1];
 if (!pqueue || !presult)
   {
   LM_ERR ("%sParameters missing!", pfncname);
   return -1;
   }
-if (pv_printf_s (pmsg, pqueue, pqname))
-  {
-  LM_ERR ("%sUnable to extract queue name!", pfncname);
-  return -1;
-  }
-
-/**********
-* o pv provided?
-* o create pv if not exist
-**********/
-
-pavp->s = presult;
-pavp->len = strlen (presult);
-if (!pavp->len)
-  {
-  LM_ERR ("%sResult pv name missing!", pfncname);
-  return -1;
-  }
-pv_spec_t *pavp_spec = pv_cache_get (pavp);
-if (!pavp_spec)
+if (fixup_get_svalue (pmsg, (gparam_p)pqueue, pqname))
   {
-  LM_ERR ("%sUnable to create pv (%.*s)!", pfncname, STR_FMT (pavp));
+  LM_ERR ("%sInvalid queue name!", pfncname);
   return -1;
   }
 
@@ -2508,9 +2295,9 @@ pv_value_t pavp_val [1];
 memset (pavp_val, 0, sizeof (pv_value_t));
 pavp_val->ri = ncount;
 pavp_val->flags = PV_TYPE_INT | PV_VAL_INT;
-if (pv_set_spec_value (0, pavp_spec, 0, pavp_val) < 0)
+if (presult->setf (pmsg, &presult->pvp, (int)EQ_T, pavp_val) < 0)
   {
-  LM_ERR ("%sUnable to set pv value (%.*s)!", pfncname, STR_FMT (pavp));
+  LM_ERR ("%sUnable to set pv value for mohq_count ()!", pfncname);
   return -1;
   }
 return 1;
@@ -2664,7 +2451,7 @@ return ret ? 1 : -1;
 * OUTPUT: -1 if no items in queue or error; 1 redirects oldest call
 **********/
 
-int mohq_retrieve (sip_msg_t *pmsg, pv_elem_t *pqueue, pv_elem_t *pURI)
+int mohq_retrieve (sip_msg_t *pmsg, char *pqueue, char *pURI)
 
 {
 /**********
@@ -2679,14 +2466,14 @@ if (!pqueue || !pURI)
   LM_ERR ("%sParameters missing!", pfncname);
   return -1;
   }
-if (pv_printf_s (pmsg, pqueue, pqname))
+if (fixup_get_svalue (pmsg, (gparam_p)pqueue, pqname))
   {
-  LM_ERR ("%sUnable to extract queue name!", pfncname);
+  LM_ERR ("%sInvalid queue name!", pfncname);
   return -1;
   }
-if (pv_printf_s (pmsg, pURI, puri))
+if (fixup_get_svalue (pmsg, (gparam_p)pURI, puri))
   {
-  LM_ERR ("%sUnable to extract URI!", pfncname);
+  LM_ERR ("%sInvalid URI!", pfncname);
   return -1;
   }
 if (puri->len > URI_LEN)
@@ -2760,28 +2547,14 @@ pcall = &pmod_data->pcall_lst [nfound];
 
 /**********
 * o save refer-to URI
-* o put call on hold
 * o send refer
-* o take call off hold
 **********/
 
 strncpy (pcall->call_referto, puri->s, puri->len);
 pcall->call_referto [puri->len] = '\0';
-if (change_hold (pcall, 1))
-  {
-  mohq_lock_release (pmod_data->pcall_lock);
-  return 1;
-  }
-mohq_lock_release (pmod_data->pcall_lock);
-LM_ERR ("%sUnable to put call (%s) on hold!", pfncname, pcall->call_from);
-if (refer_call (pcall))
+if (refer_call (pcall, pmod_data->pcall_lock))
   { return 1; }
 LM_ERR ("%sUnable to refer call (%s)!", pfncname, pcall->call_from);
-if (!change_hold (pcall, 0))
-  {
-  pcall->call_state = CLSTA_INQUEUE;
-  update_call_rec (pcall);
-  }
 return -1;
 }
 
@@ -2794,7 +2567,7 @@ return -1;
 * OUTPUT: -1 if no items in queue; 1 if successfull
 **********/
 
-int mohq_send (sip_msg_t *pmsg, pv_elem_t *pqueue)
+int mohq_send (sip_msg_t *pmsg, char *pqueue)
 
 {
 /**********
@@ -2820,9 +2593,9 @@ if (!pqueue)
   LM_ERR ("%sParameters missing!", pfncname);
   return -1;
   }
-if (pv_printf_s (pmsg, pqueue, pqname))
+if (fixup_get_svalue (pmsg, (gparam_p)pqueue, pqname))
   {
-  LM_ERR ("%sUnable to extract queue name!", pfncname);
+  LM_ERR ("%sInvalid queue name!", pfncname);
   return -1;
   }
 

+ 3 - 3
modules/mohqueue/mohq_funcs.h

@@ -31,10 +31,10 @@
 rtpmap **find_MOH (char *, char *);
 struct mi_root *mi_debug (struct mi_root *, void *);
 struct mi_root *mi_drop_call (struct mi_root *, void *);
-int mohq_count (sip_msg_t *, pv_elem_t *, char *);
+int mohq_count (sip_msg_t *, char *, pv_spec_t *);
 void mohq_debug (mohq_lst *, char *, ...);
 int mohq_process (sip_msg_t *);
-int mohq_retrieve (sip_msg_t *, pv_elem_t *, pv_elem_t *);
-int mohq_send (sip_msg_t *, pv_elem_t *);
+int mohq_retrieve (sip_msg_t *, char *, char *);
+int mohq_send (sip_msg_t *, char *);
 
 #endif /* MOHQ_FUNCS_H */