Browse code

core: add Referred-By to AmSipDialog::refer()

Stefan Sayer authored on 03/01/2014 12:59:18
Showing 3 changed files
... ...
@@ -626,12 +626,16 @@ int AmSipDialog::update(const AmMimeBody* body,
626 626
 }
627 627
 
628 628
 int AmSipDialog::refer(const string& refer_to,
629
-		       int expires)
629
+		       int expires,
630
+		       const string& referred_by)
630 631
 {
631 632
   if(getStatus() == Connected) {
632 633
     string hdrs = SIP_HDR_COLSP(SIP_HDR_REFER_TO) + refer_to + CRLF;
633 634
     if (expires>=0) 
634 635
       hdrs+= SIP_HDR_COLSP(SIP_HDR_EXPIRES) + int2str(expires) + CRLF;
636
+    if (!referred_by.empty())
637
+      hdrs+= SIP_HDR_COLSP(SIP_HDR_REFERRED_BY) + referred_by + CRLF;
638
+
635 639
     return sendRequest("REFER", NULL, hdrs);
636 640
   }
637 641
   else {
... ...
@@ -159,7 +159,8 @@ protected:
159 159
 
160 160
   /** @return 0 on success */
161 161
   int refer(const string& refer_to,
162
-	    int expires = -1);
162
+	    int expires = -1,
163
+	    const string& referred_by = "");
163 164
 
164 165
   /** @return 0 on success */
165 166
   int transfer(const string& target);
... ...
@@ -36,6 +36,7 @@
36 36
 #define SIP_HDR_P_ASSERTED_IDENTITY "P-Asserted-Identity"
37 37
 #define SIP_HDR_P_PREFERRED_IDENTITY "P-Preferred-Identity"
38 38
 #define SIP_HDR_REFER_TO        "Refer-To"
39
+#define SIP_HDR_REFERRED_BY     "Referred-By"
39 40
 #define SIP_HDR_EXPIRES         "Expires"
40 41
 #define SIP_HDR_MIN_EXPIRES     "Min-Expires"
41 42
 #define SIP_HDR_SESSION_EXPIRES "Session-Expires"