Browse code

sbc: new CC module callback within relayEvent

Václav Kubart authored on 13/08/2013 06:32:37
Showing 2 changed files
... ...
@@ -73,6 +73,13 @@ class ExtendedCCInterface
73 73
     virtual CCChainProcessing createHoldRequest(SBCCallLeg *call, AmSdp &sdp) { return ContinueProcessing; }
74 74
     virtual CCChainProcessing handleHoldReply(SBCCallLeg *call, bool succeeded) { return ContinueProcessing; }
75 75
 
76
+    /** Possibility to influence messages relayed to the B2B peer leg.
77
+      return value:
78
+      - lower than 0 means error (returned upstream, the one
79
+      returning error is responsible for destrying the event instance)
80
+      - greater than 0 means "stop processing and return 0 upstream"
81
+      - equal to 0 means "continue processing" */
82
+    virtual int relayEvent(SBCCallLeg *call, AmEvent *e) { return 0; }
76 83
 
77 84
     // using extended CC modules with simple relay
78 85
 
... ...
@@ -399,6 +399,12 @@ void SBCCallLeg::applyBProfile()
399 399
 
400 400
 int SBCCallLeg::relayEvent(AmEvent* ev)
401 401
 {
402
+  for (vector<ExtendedCCInterface*>::iterator i = cc_ext.begin(); i != cc_ext.end(); ++i) {
403
+    int res = (*i)->relayEvent(this, ev);
404
+    if (res > 0) return 0;
405
+    if (res < 0) return res;
406
+  }
407
+
402 408
     switch (ev->event_id) {
403 409
       case B2BSipRequest:
404 410
         {