Browse code

dsm:mod_dlg:added dlg.getOtherId action

Stefan Sayer authored on 02/11/2013 15:30:05
Showing 2 changed files
... ...
@@ -51,6 +51,8 @@ MOD_ACTIONEXPORT_BEGIN(MOD_CLS_NAME) {
51 51
 
52 52
   DEF_CMD("dlg.getRequestBody", DLGGetRequestBodyAction)
53 53
   DEF_CMD("dlg.getReplyBody", DLGGetReplyBodyAction)
54
+
55
+  DEF_CMD("dlg.getOtherId", DLGGetOtherIdAction)
54 56
 } MOD_ACTIONEXPORT_END;
55 57
 
56 58
 //MOD_CONDITIONEXPORT_NONE(MOD_CLS_NAME);
... ...
@@ -419,3 +421,16 @@ EXEC_ACTION_START(DLGGetReplyBodyAction) {
419 421
     DBG("set $%s='%s'\n", dstvar.c_str(), sc_sess->var[dstvar].c_str());
420 422
   }
421 423
 } EXEC_ACTION_END;
424
+
425
+EXEC_ACTION_START(DLGGetOtherIdAction) {
426
+  string varname = arg;
427
+  AmB2BSession* b2b_sess = dynamic_cast<AmB2BSession*>(sess);
428
+  if (NULL == b2b_sess) {
429
+    DBG("script writer error: dlg.getOtherId used without B2B session object.\n");
430
+    EXEC_ACTION_STOP;
431
+  }
432
+
433
+  if (varname.size() && varname[0] == '$')
434
+    varname.erase(0, 1);
435
+  sc_sess->var[varname] = b2b_sess->getOtherId();
436
+} EXEC_ACTION_END;
... ...
@@ -47,4 +47,6 @@ DEF_SCCondition(DLGReplyHasContentTypeCondition);
47 47
 DEF_SCCondition(DLGRequestHasContentTypeCondition);
48 48
 DEF_ACTION_2P(DLGGetRequestBodyAction);
49 49
 DEF_ACTION_2P(DLGGetReplyBodyAction);
50
+
51
+DEF_ACTION_1P(DLGGetOtherIdAction);
50 52
 #endif