Module: sems Branch: master Commit: 1ea21ee4bb9303dc297e5361bd0ba260ea2e137f URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=1ea21ee4bb9303dc297e5361bd0ba260ea2e137f
Author: Juha Heinanen <[email protected]> Committer: Juha Heinanen <[email protected]> Date: Thu May 8 14:56:50 2014 +0300 apps/dsm/mod_dlg: new action dlg.deleteReplyBodyPart(content_type) - added also dlg.addReplyBodyPart to Readme --- apps/dsm/mods/mod_dlg/ModDlg.cpp | 18 ++++++++++++++++++ apps/dsm/mods/mod_dlg/ModDlg.h | 2 ++ doc/dsm/mods/Readme.mod_dlg.txt | 4 ++++ 3 files changed, 24 insertions(+), 0 deletions(-) diff --git a/apps/dsm/mods/mod_dlg/ModDlg.cpp b/apps/dsm/mods/mod_dlg/ModDlg.cpp index 84c4e55..d687706 100644 --- a/apps/dsm/mods/mod_dlg/ModDlg.cpp +++ b/apps/dsm/mods/mod_dlg/ModDlg.cpp @@ -59,6 +59,7 @@ MOD_ACTIONEXPORT_BEGIN(MOD_CLS_NAME) { DEF_CMD("dlg.relayError", DLGB2BRelayErrorAction); DEF_CMD("dlg.addReplyBodyPart", DLGAddReplyBodyPartAction); + DEF_CMD("dlg.deleteReplyBodyPart", DLGDeleteReplyBodyPartAction); } MOD_ACTIONEXPORT_END; @@ -549,3 +550,20 @@ EXEC_ACTION_START(DLGAddReplyBodyPartAction) { DBG("added to reply body part %s='%s'\n", content_type.c_str(), body_part.c_str()); } EXEC_ACTION_END; + +EXEC_ACTION_START(DLGDeleteReplyBodyPartAction) { + DSMMutableSipReply* sip_reply; + + AVarMapT::iterator it = sc_sess->avar.find(DSM_AVAR_REPLY); + if (it == sc_sess->avar.end() || + !isArgAObject(it->second) || + !(sip_reply = dynamic_cast<DSMMutableSipReply*>(it->second.asObject()))) { + throw DSMException("dlg", "cause", "no reply"); + } + + if (sip_reply->mutable_reply->body.deletePart(arg)) { + INFO("failed to delete reply body part '%s'\n", arg.c_str()); + } else { + INFO("deleted reply body part '%s'\n", arg.c_str()); + } +} EXEC_ACTION_END; diff --git a/apps/dsm/mods/mod_dlg/ModDlg.h b/apps/dsm/mods/mod_dlg/ModDlg.h index 2b07afb..23cb104 100644 --- a/apps/dsm/mods/mod_dlg/ModDlg.h +++ b/apps/dsm/mods/mod_dlg/ModDlg.h @@ -55,4 +55,6 @@ DEF_ACTION_2P(DLGReferAction); DEF_ACTION_2P(DLGB2BRelayErrorAction); DEF_ACTION_2P(DLGAddReplyBodyPartAction); +DEF_ACTION_1P(DLGDeleteReplyBodyPartAction); + #endif diff --git a/doc/dsm/mods/Readme.mod_dlg.txt b/doc/dsm/mods/Readme.mod_dlg.txt index 75810d0..1a85177 100644 --- a/doc/dsm/mods/Readme.mod_dlg.txt +++ b/doc/dsm/mods/Readme.mod_dlg.txt @@ -89,6 +89,10 @@ Request/Reply Body handling in sipRequest/sipReply events: actions (applicable only in sipRequest/sipReply event handling blocks): dlg.getRequestBody(content_type, dstvar) - get body of content_type in $dstvar dlg.getReplyBody(content_type, dstvar) - get body of content_type in $dstvar +dlg.addReplyBodyPart(content_type, payload) - add new body part possibly + converting the resulting body to multipart +dlg.deleteReplyBodyPart(content_type) - delete body part from multipart + body possibly converting the resulting body to singlepart conditions: dlg.replyHasContentType(content_type) and dlg.requestHasContentType(content_type) _______________________________________________ Semsdev mailing list [email protected] http://lists.iptel.org/mailman/listinfo/semsdev
