Explorar o código

- added mi function to bridge two sip addresses

git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@5532 689a6050-402a-0410-94f2-e92a70836424
Daniel-Constantin Mierla %!s(int64=16) %!d(string=hai) anos
pai
achega
9224dafc95
Modificáronse 2 ficheiros con 43 adicións e 1 borrados
  1. 42 0
      modules_k/dialog/dialog.c
  2. 1 1
      modules_k/dialog/dlg_transfer.c

+ 42 - 0
modules_k/dialog/dialog.c

@@ -212,6 +212,7 @@ static stat_export_t mod_stats[] = {
 	{0,0,0}
 };
 
+struct mi_root * mi_dlg_bridge(struct mi_root *cmd_tree, void *param);
 
 static mi_export_t mi_cmds[] = {
 	{ "dlg_list",           mi_print_dlgs,       0,  0,  0},
@@ -219,6 +220,7 @@ static mi_export_t mi_cmds[] = {
 	{ "dlg_end_dlg",        mi_terminate_dlg,    0,  0,  0},
 	{ "profile_get_size",   mi_get_profile,      0,  0,  0},
 	{ "profile_list_dlgs",  mi_profile_list,     0,  0,  0},
+	{ "dlg_bridge",         mi_dlg_bridge,       0,  0,  0},
 	{ 0, 0, 0, 0, 0}
 };
 
@@ -1002,3 +1004,43 @@ static int w_dlg_get(struct sip_msg *msg, char *ci, char *ft, char *tt)
 	_dlg_ctx.dir = dir;
 	return 1;
 }
+
+struct mi_root * mi_dlg_bridge(struct mi_root *cmd_tree, void *param)
+{
+	str from = {0,0};
+	str to = {0,0};
+	str op = {0,0};
+	struct mi_node* node;
+
+	node = cmd_tree->node.kids;
+	if(node == NULL)
+		return init_mi_tree( 400, MI_MISSING_PARM_S, MI_MISSING_PARM_LEN);
+	from = node->value;
+	if(from.len<=0 || from.s==NULL)
+	{
+		LM_ERR("bad From value\n");
+		return init_mi_tree( 500, "Bad From value", 14);
+	}
+
+	node = node->next;
+	if(node == NULL)
+		return init_mi_tree( 400, MI_MISSING_PARM_S, MI_MISSING_PARM_LEN);
+	to = node->value;
+	if(to.len<=0 || to.s == NULL)
+	{
+		return init_mi_tree(500, "Bad To value", 12);
+	}
+
+	node= node->next;
+	if(node != NULL)
+	{
+		op = node->value;
+	}
+
+	if(dlg_bridge(&from, &to, &op)!=0)
+		return init_mi_tree(500, MI_INTERNAL_ERR_S,  MI_INTERNAL_ERR_LEN);
+
+	return init_mi_tree(200, MI_OK_S, MI_OK_LEN);
+}
+
+

+ 1 - 1
modules_k/dialog/dlg_transfer.c

@@ -39,7 +39,7 @@
 #define DLG_HOLD_SDP "v=0\r\no=kamailio-bridge 0 0 IN IP4 0.0.0.0\r\ns=kamailio\r\nc=IN IP4 0.0.0.0\r\nt=0 0\r\nm=audio 9 RTP/AVP 8 0\r\na=rtpmap:8 PCMA/8000\r\na=rtpmap:0 PCMU/8000\r\n"
 #define DLG_HOLD_SDP_LEN	(sizeof(DLG_HOLD_SDP)-1)
 
-#define DLG_HOLD_CT_HDR "Contact: <sip:192.168.1.23>\r\nContent-Type: application/sdp\r\n"
+#define DLG_HOLD_CT_HDR "Contact: <sip:kamailio.org:5060>\r\nContent-Type: application/sdp\r\n"
 #define DLG_HOLD_CT_HDR_LEN	(sizeof(DLG_HOLD_CT_HDR)-1)
 
 extern str dlg_bridge_controller;