|
@@ -50,11 +50,14 @@ static int w_mq_size(struct sip_msg *msg, char *mq, char *str2);
|
|
static int w_mq_add(struct sip_msg* msg, char* mq, char* key, char* val);
|
|
static int w_mq_add(struct sip_msg* msg, char* mq, char* key, char* val);
|
|
static int w_mq_pv_free(struct sip_msg* msg, char* mq, char* str2);
|
|
static int w_mq_pv_free(struct sip_msg* msg, char* mq, char* str2);
|
|
int mq_param(modparam_t type, void *val);
|
|
int mq_param(modparam_t type, void *val);
|
|
|
|
+int mq_param_name(modparam_t type, void *val);
|
|
static int fixup_mq_add(void** param, int param_no);
|
|
static int fixup_mq_add(void** param, int param_no);
|
|
static int bind_mq(mq_api_t* api);
|
|
static int bind_mq(mq_api_t* api);
|
|
|
|
|
|
static int mqueue_rpc_init(void);
|
|
static int mqueue_rpc_init(void);
|
|
|
|
|
|
|
|
+static int mqueue_size = 0;
|
|
|
|
+
|
|
|
|
|
|
static pv_export_t mod_pvs[] = {
|
|
static pv_export_t mod_pvs[] = {
|
|
{ {"mqk", sizeof("mqk")-1}, PVT_OTHER, pv_get_mqk, 0,
|
|
{ {"mqk", sizeof("mqk")-1}, PVT_OTHER, pv_get_mqk, 0,
|
|
@@ -84,6 +87,8 @@ static cmd_export_t cmds[]={
|
|
static param_export_t params[]={
|
|
static param_export_t params[]={
|
|
{"db_url", PARAM_STR, &mqueue_db_url},
|
|
{"db_url", PARAM_STR, &mqueue_db_url},
|
|
{"mqueue", PARAM_STRING|USE_FUNC_PARAM, (void*)mq_param},
|
|
{"mqueue", PARAM_STRING|USE_FUNC_PARAM, (void*)mq_param},
|
|
|
|
+ {"mqueue_name", PARAM_STRING|USE_FUNC_PARAM, (void*)mq_param_name},
|
|
|
|
+ {"mqueue_size", INT_PARAM, &mqueue_size },
|
|
{0, 0, 0}
|
|
{0, 0, 0}
|
|
};
|
|
};
|
|
|
|
|
|
@@ -268,6 +273,39 @@ int mq_param(modparam_t type, void *val)
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+int mq_param_name(modparam_t type, void *val)
|
|
|
|
+{
|
|
|
|
+ str qname = {0, 0};
|
|
|
|
+ int msize = 0;
|
|
|
|
+
|
|
|
|
+ if(val==NULL)
|
|
|
|
+ return -1;
|
|
|
|
+
|
|
|
|
+ if(!shm_initialized())
|
|
|
|
+ {
|
|
|
|
+ LM_ERR("shm not initialized - cannot define mqueue now\n");
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ qname.s = (char*)val;
|
|
|
|
+ qname.len = strlen(qname.s);
|
|
|
|
+
|
|
|
|
+ msize = mqueue_size;
|
|
|
|
+
|
|
|
|
+ if(qname.len<=0)
|
|
|
|
+ {
|
|
|
|
+ LM_ERR("mqueue name not defined: %.*s\n", qname.len, qname.s);
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
+ if(mq_head_add(&qname, msize)<0)
|
|
|
|
+ {
|
|
|
|
+ LM_ERR("cannot add mqueue: %.*s\n", qname.len, qname.s);
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
+ LM_INFO("mqueue param: [%.*s|%d]\n", qname.len, qname.s, msize);
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
static int fixup_mq_add(void** param, int param_no)
|
|
static int fixup_mq_add(void** param, int param_no)
|
|
{
|
|
{
|
|
if(param_no==1 || param_no==2 || param_no==3) {
|
|
if(param_no==1 || param_no==2 || param_no==3) {
|