Browse code

adapt to new on[Early]SessionStart behavior

Raphael Coeffic authored on 14/07/2011 14:04:49
Showing 44 changed files
... ...
@@ -120,6 +120,8 @@ void AnnounceCallerDialog::onSessionStart()
120 120
     throw string("AnnouncementDialog::onSessionStart: Cannot open file\n");
121 121
     
122 122
   setOutput(&wav_file);
123
+
124
+  AmB2BCallerSession::onSessionStart();
123 125
 }
124 126
 
125 127
 void AnnounceCallerDialog::process(AmEvent* event)
... ...
@@ -129,6 +129,8 @@ void AnnounceTransferDialog::onSessionStart()
129 129
     status = Announcing;
130 130
     startSession();
131 131
   }
132
+
133
+  AmSession::onSessionStart();
132 134
 }
133 135
 
134 136
 void AnnounceTransferDialog::startSession() {
... ...
@@ -155,6 +155,8 @@ void AnnouncementDialog::onSessionStart() {
155 155
     wav_file.loop.set(true);
156 156
 
157 157
   setOutput(&wav_file);
158
+
159
+  AmSession::onSessionStart();
158 160
 }
159 161
 
160 162
 void AnnouncementDialog::onBye(const AmSipRequest& req)
... ...
@@ -279,6 +279,8 @@ void AnnRecorderDialog::onSessionStart()
279 279
   // set the playlist as input and output
280 280
   setInOut(&playlist,&playlist);  
281 281
   state = S_WAIT_START;
282
+
283
+  AmSession::onSessionStart();
282 284
 }
283 285
 
284 286
 void AnnRecorderDialog::enqueueCurrent() {
... ...
@@ -257,6 +257,8 @@ void CallBackDialog::onSessionStart()
257 257
   prompts.addToPlaylist(WELCOME_PROMPT,  (long)this, play_list);
258 258
   // set the playlist as input and output
259 259
   setInOut(&play_list,&play_list);
260
+
261
+  AmB2ABCallerSession::onSessionStart();
260 262
 }
261 263
  
262 264
 void CallBackDialog::onDtmf(int event, int duration)
... ...
@@ -196,26 +196,29 @@ AmB2BCallerSession()
196 196
   set_sip_relay_early_media_sdp(Click2DialFactory::relay_early_media_sdp);
197 197
 }
198 198
 
199
+void C2DCallerDialog::onInvite(const AmSipRequest& req)
200
+{
201
+  ERROR("incoming calls not supported in click2dial app!\n");
202
+  dlg.reply(req,606,"Not Acceptable");
203
+  setStopped();
204
+}
199 205
 
200
-void C2DCallerDialog::onSessionStart(const AmSipReply& rep)
206
+void C2DCallerDialog::onInvite2xx(const AmSipReply& reply)
201 207
 {
202
-  setReceiving(false);
203
-  invite_req.body = rep.body;
204
-  invite_req.content_type = rep.content_type;
205
-  invite_req.cseq = rep.cseq;
206
-  est_invite_cseq = rep.cseq;
208
+  invite_req.body = reply.body;
209
+  invite_req.content_type = reply.content_type;
210
+  invite_req.cseq = reply.cseq;
211
+  est_invite_cseq = reply.cseq;
212
+}
207 213
 
214
+void C2DCallerDialog::onSessionStart()
215
+{
216
+  setReceiving(false);
208 217
   if(wav_file.open(filename,AmAudioFile::Read))
209 218
     throw string("AnnouncementDialog::onSessionStart: Cannot open file\n");
210 219
   setOutput(&wav_file);
211
-}
212
-
213 220
 
214
-void C2DCallerDialog::onSessionStart(const AmSipRequest& req)
215
-{
216
-  ERROR("incoming calls not supported in click2dial app!\n");
217
-  dlg.bye();
218
-  setStopped();
221
+  AmB2BCallerSession::onSessionStart();
219 222
 }
220 223
 
221 224
 void C2DCallerDialog::updateUACTransCSeq(unsigned int old_cseq, unsigned int new_cseq) {
... ...
@@ -70,8 +70,9 @@ class C2DCallerDialog: public AmB2BCallerSession, public CredentialHolder
70 70
       const string& callee_uri, UACAuthCred* credentials = NULL);
71 71
 
72 72
     void process(AmEvent* event);
73
-    void onSessionStart(const AmSipRequest& req);
74
-    void onSessionStart(const AmSipReply& rep);
73
+    void onInvite(const AmSipRequest& req);
74
+    void onInvite2xx(const AmSipReply& reply);
75
+    void onSessionStart();
75 76
     void createCalleeSession();
76 77
     inline UACAuthCred* getCredentials() { return cred.get(); }
77 78
     void onB2BEvent(B2BEvent*);
... ...
@@ -404,8 +404,11 @@ ConferenceDialog::~ConferenceDialog()
404 404
 void ConferenceDialog::onStart() {
405 405
 }
406 406
 
407
-void ConferenceDialog::onSessionStart(const AmSipRequest& req)
407
+void ConferenceDialog::onInvite(const AmSipRequest& req)
408 408
 {
409
+  if(dlg.getStatus() == AmSipDialog::Connected)
410
+    return;
411
+
409 412
   int i, len;
410 413
   string lonely_user_file;
411 414
 
... ...
@@ -482,14 +485,12 @@ void ConferenceDialog::onSessionStart(const AmSipRequest& req)
482 485
 
483 486
   DBG("Using LonelyUserFile <%s>\n",
484 487
       ConferenceFactory::LonelyUserFile.c_str());
485
-	
486
-  setupAudio();
487 488
 }
488 489
 
489
-// void ConferenceDialog::onSessionStart(const AmSipReply& reply)
490
-// {
491
-//     setupAudio();
492
-// }
490
+void ConferenceDialog::onSessionStart()
491
+{
492
+  setupAudio();
493
+}
493 494
 
494 495
 void ConferenceDialog::setupAudio()
495 496
 {
... ...
@@ -152,7 +152,8 @@ public:
152 152
   void process(AmEvent* ev);
153 153
   void onStart();
154 154
   void onDtmf(int event, int duration);
155
-  void onSessionStart(const AmSipRequest& req);
155
+  void onInvite(const AmSipRequest& req);
156
+  void onSessionStart();
156 157
   void onBye(const AmSipRequest& req);
157 158
 
158 159
   void onSipRequest(const AmSipRequest& req);
... ...
@@ -160,6 +160,8 @@ void DSMCall::onEarlySessionStart() {
160 160
 
161 161
     if (!getOutput())
162 162
       setOutput(&playlist);
163
+
164
+    AmB2BCallerSession::onEarlySessionStart();
163 165
   }
164 166
 }
165 167
 
... ...
@@ -167,10 +169,11 @@ void DSMCall::onSessionStart()
167 169
 {
168 170
   if (process_sessionstart) {
169 171
     process_sessionstart = false;
170
-    AmB2BCallerSession::onSessionStart();
171 172
 
172 173
     DBG("DSMCall::onSessionStart\n");
173 174
     startSession();
175
+
176
+    AmB2BCallerSession::onSessionStart();
174 177
   }
175 178
 }
176 179
 
... ...
@@ -343,6 +343,8 @@ void EarlyAnnounceDialog::onEarlySessionStart()
343 343
     throw string("EarlyAnnounceDialog::onEarlySessionStart: Cannot open file");
344 344
     
345 345
   setOutput(&wav_file);
346
+
347
+  AmB2BCallerSession::onEarlySessionStart();
346 348
 }
347 349
 
348 350
 void EarlyAnnounceDialog::onBye(const AmSipRequest& req)
... ...
@@ -88,7 +88,8 @@ int AnnounceAuthFactory::onLoad()
88 88
     return 0;
89 89
 }
90 90
 
91
-AmSession* AnnounceAuthFactory::onInvite(const AmSipRequest& req)
91
+AmSession* AnnounceAuthFactory::onInvite(const AmSipRequest& req, const string& app_name,
92
+					 const map<string,string>& app_params)
92 93
 {
93 94
     string announce_path = AnnouncePath;
94 95
     string announce_file = announce_path + req.domain 
... ...
@@ -139,19 +140,16 @@ AnnounceAuthDialog::~AnnounceAuthDialog()
139 140
 {
140 141
 }
141 142
 
142
-void AnnounceAuthDialog::onSessionStart(const AmSipRequest& req)
143
+void AnnounceAuthDialog::onSessionStart()
143 144
 {
144 145
     DBG("AnnounceAuthDialog::onSessionStart\n");
145 146
     startSession();
146
-}
147 147
 
148
-void AnnounceAuthDialog::onSessionStart(const AmSipReply& rep)
149
-{
150
-    DBG("AnnounceAuthDialog::onSessionStart (SEMS originator mode)\n");
151
-    startSession();
148
+    AmSession::onSessionStart();
152 149
 }
153 150
 
154
-void AnnounceAuthDialog::startSession(){
151
+void AnnounceAuthDialog::startSession()
152
+{
155 153
     // disable DTMF detection - don't use DTMF here
156 154
     setDtmfDetectionEnabled(false);
157 155
 
... ...
@@ -67,7 +67,8 @@ public:
67 67
     AnnounceAuthFactory(const string& _app_name);
68 68
 
69 69
     int onLoad();
70
-    AmSession* onInvite(const AmSipRequest& req);
70
+    AmSession* onInvite(const AmSipRequest& req, const string& app_name,
71
+			const map<string,string>& app_params);
71 72
 };
72 73
 
73 74
 class AnnounceAuthDialog : public AmSession,
... ...
@@ -84,14 +85,13 @@ class AnnounceAuthDialog : public AmSession,
84 85
 					   const string& auth_pwd);
85 86
     ~AnnounceAuthDialog();
86 87
 
87
-    void onSessionStart(const AmSipRequest& req);
88
-    void onSessionStart(const AmSipReply& rep);
88
+    void onSessionStart();
89 89
     void startSession();
90 90
     void onBye(const AmSipRequest& req);
91 91
     void onDtmf(int event, int duration_msec) {}
92 92
 
93 93
     void process(AmEvent* event);
94
-	inline UACAuthCred* getCredentials();
94
+    inline UACAuthCred* getCredentials();
95 95
 };
96 96
 
97 97
 
... ...
@@ -141,9 +141,9 @@ void b2b_connectDialog::onInvite(const AmSipRequest& req)
141 141
 
142 142
 }
143 143
 
144
-void b2b_connectDialog::onSessionStart(const AmSipRequest& req)
144
+void b2b_connectDialog::onSessionStart()
145 145
 {
146
-  AmB2ABCallerSession::onSessionStart(req);
146
+  AmB2ABCallerSession::onSessionStart();
147 147
 }
148 148
 
149 149
 void b2b_connectDialog::onB2ABEvent(B2ABEvent* ev)
... ...
@@ -62,7 +62,7 @@ class b2b_connectDialog : public AmB2ABCallerSession
62 62
   b2b_connectDialog();
63 63
   ~b2b_connectDialog();
64 64
   
65
-  void onSessionStart(const AmSipRequest& req);
65
+  void onSessionStart();
66 66
   void onB2ABEvent(B2ABEvent* ev);
67 67
   void process(AmEvent* ev);
68 68
   void onDtmf(int event, int duration);
... ...
@@ -75,7 +75,8 @@ int CacheAnnounceFactory::onLoad()
75 75
     return 0;
76 76
 }
77 77
 
78
-AmSession* CacheAnnounceFactory::onInvite(const AmSipRequest& req)
78
+AmSession* CacheAnnounceFactory::onInvite(const AmSipRequest& req, const string& app_name,
79
+					  const map<string,string>& app_params)
79 80
 {
80 81
     return new CacheAnnounceDialog(&ann_cache);
81 82
 }
... ...
@@ -89,24 +90,20 @@ CacheAnnounceDialog::~CacheAnnounceDialog()
89 90
 {
90 91
 }
91 92
 
92
-void CacheAnnounceDialog::onSessionStart(const AmSipRequest& req)
93
+void CacheAnnounceDialog::onSessionStart()
93 94
 {
94 95
     DBG("CacheAnnounceDialog::onSessionStart\n");
95 96
     startSession();
96
-}
97 97
 
98
-void CacheAnnounceDialog::onSessionStart(const AmSipReply& rep)
99
-{
100
-    DBG("CacheAnnounceDialog::onSessionStart (SEMS originator mode)\n");
101
-    startSession();
98
+    AmSession::onSessionStart();
102 99
 }
103 100
 
104 101
 void CacheAnnounceDialog::startSession(){
105 102
     setDtmfDetectionEnabled(false);
106 103
 
107
-	wav_file.reset(new AmCachedAudioFile(announce));
104
+    wav_file.reset(new AmCachedAudioFile(announce));
108 105
     if (!wav_file->is_good())
109
-		throw AmSession::Exception(500, "Internal Err");
106
+      throw AmSession::Exception(500, "Internal Err");
110 107
 
111 108
     setOutput(wav_file.get());
112 109
 }
... ...
@@ -50,7 +50,8 @@ public:
50 50
     CacheAnnounceFactory(const string& _app_name);
51 51
 
52 52
     int onLoad();
53
-    AmSession* onInvite(const AmSipRequest& req);
53
+    AmSession* onInvite(const AmSipRequest& req, const string& app_name,
54
+			const map<string,string>& app_params);
54 55
 };
55 56
 
56 57
 class CacheAnnounceDialog : public AmSession
... ...
@@ -62,8 +63,7 @@ class CacheAnnounceDialog : public AmSession
62 63
     CacheAnnounceDialog(AmFileCache* announce);
63 64
     ~CacheAnnounceDialog();
64 65
 
65
-    void onSessionStart(const AmSipRequest& req);
66
-    void onSessionStart(const AmSipReply& rep);
66
+    void onSessionStart();
67 67
     void startSession();
68 68
     void onBye(const AmSipRequest& req);
69 69
     void onDtmf(int event, int duration_msec) {}
... ...
@@ -416,6 +416,8 @@ void CallGenDialog::setCallTimer() {
416 416
 
417 417
 void CallGenDialog::onEarlySessionStart() {
418 418
   setCallTimer();
419
+
420
+  AmSession::onEarlySessionStart();
419 421
 }
420 422
 
421 423
 void CallGenDialog::onSessionStart() {
... ...
@@ -438,6 +440,8 @@ void CallGenDialog::onSessionStart() {
438 440
   setInOut(&play_list, &play_list);
439 441
 
440 442
   setCallTimer();
443
+
444
+  AmSession::onSessionStart();
441 445
 }
442 446
 
443 447
 void CallGenDialog::process(AmEvent* event)
... ...
@@ -89,13 +89,14 @@ string DtmfTesterFactory::getAnnounceFile(const AmSipRequest& req) {
89 89
   return announce_file;
90 90
 }
91 91
 
92
-AmSession* DtmfTesterFactory::onInvite(const AmSipRequest& req)
92
+AmSession* DtmfTesterFactory::onInvite(const AmSipRequest& req, const string& app_name,
93
+				       const map<string,string>& app_params)
93 94
 {
94 95
   return new DtmfTesterDialog(getAnnounceFile(req), NULL);
95 96
 }
96 97
 
97
-AmSession* DtmfTesterFactory::onInvite(const AmSipRequest& req,
98
-					 AmArg& session_params)
98
+AmSession* DtmfTesterFactory::onInvite(const AmSipRequest& req, const string& app_name,
99
+				       AmArg& session_params)
99 100
 {
100 101
   UACAuthCred* cred = NULL;
101 102
   if (session_params.getType() == AmArg::AObject) {
... ...
@@ -141,16 +142,12 @@ DtmfTesterDialog::~DtmfTesterDialog()
141 142
 
142 143
 }
143 144
 
144
-void DtmfTesterDialog::onSessionStart(const AmSipRequest& req)
145
+void DtmfTesterDialog::onSessionStart()
145 146
 {
146 147
   DBG("DtmfTesterDialog::onSessionStart\n");
147 148
   startSession();
148
-}
149
-
150
-void DtmfTesterDialog::onSessionStart(const AmSipReply& rep)
151
-{
152
-  DBG("DtmfTesterDialog::onSessionStart (SEMS originator mode)\n");
153
-  startSession();
149
+  
150
+  AmSession::onSessionStart();
154 151
 }
155 152
 
156 153
 void DtmfTesterDialog::startSession(){
... ...
@@ -49,8 +49,9 @@ public:
49 49
   DtmfTesterFactory(const string& _app_name);
50 50
 
51 51
   int onLoad();
52
-  AmSession* onInvite(const AmSipRequest& req);
53
-  AmSession* onInvite(const AmSipRequest& req,
52
+  AmSession* onInvite(const AmSipRequest& req, const string& app_name,
53
+		      const map<string,string>& app_params);
54
+  AmSession* onInvite(const AmSipRequest& req, const string& app_name,
54 55
 		      AmArg& session_params);
55 56
 
56 57
 };
... ...
@@ -74,8 +75,7 @@ public:
74 75
 		     UACAuthCred* credentials = NULL);
75 76
   ~DtmfTesterDialog();
76 77
 
77
-  void onSessionStart(const AmSipRequest& req);
78
-  void onSessionStart(const AmSipReply& rep);
78
+  void onSessionStart();
79 79
   void startSession();
80 80
   void onBye(const AmSipRequest& req);
81 81
   void onDtmf(int event, int duration_msec);
... ...
@@ -22,13 +22,14 @@ int EarlyRecordFactory::onLoad()
22 22
     return 0;
23 23
 }
24 24
 
25
-AmSession* EarlyRecordFactory::onInvite(const AmSipRequest& req)
25
+AmSession* EarlyRecordFactory::onInvite(const AmSipRequest& req, const string& app_name,
26
+					const map<string,string>& app_params)
26 27
 {
27 28
   return new EarlyRecordDialog(NULL);
28 29
 }
29 30
 
30 31
 // auth with di_dial
31
-AmSession* EarlyRecordFactory::onInvite(const AmSipRequest& req,
32
+AmSession* EarlyRecordFactory::onInvite(const AmSipRequest& req, const string& app_name,
32 33
 					AmArg& session_params)
33 34
 {
34 35
   UACAuthCred* cred = NULL;
... ...
@@ -70,7 +71,7 @@ EarlyRecordDialog::~EarlyRecordDialog()
70 71
 {
71 72
 }
72 73
 
73
-void EarlyRecordDialog::onEarlySessionStart(const AmSipReply& req) {
74
+void EarlyRecordDialog::onEarlySessionStart() {
74 75
   DBG("Early Session Start\n");
75 76
   msg_filename = "/tmp/" + getLocalTag() + ".wav";
76 77
   
... ...
@@ -80,9 +81,11 @@ void EarlyRecordDialog::onEarlySessionStart(const AmSipReply& req) {
80 81
   
81 82
   setInput(&a_msg);
82 83
   setMute(true);
84
+
85
+  AmSession::onEarlySessionStart();
83 86
 }
84 87
 
85
-void EarlyRecordDialog::onSessionStart(const AmSipReply& req)
88
+void EarlyRecordDialog::onSessionStart()
86 89
 {
87 90
   setInOut(NULL, NULL);
88 91
 
... ...
@@ -96,6 +99,8 @@ void EarlyRecordDialog::onSessionStart(const AmSipReply& req)
96 99
       msg_filename + string(" for writing");
97 100
 
98 101
   setOutput(&a_msg);
102
+
103
+  AmSession::onSessionStart();
99 104
 }
100 105
 
101 106
 void EarlyRecordDialog::onBye(const AmSipRequest& req)
... ...
@@ -16,8 +16,9 @@ public:
16 16
     EarlyRecordFactory(const string& _app_name);
17 17
 
18 18
     int onLoad();
19
-    AmSession* onInvite(const AmSipRequest& req);
20
-    AmSession* onInvite(const AmSipRequest& req,
19
+    AmSession* onInvite(const AmSipRequest& req, const string& app_name,
20
+			const map<string,string>& app_params);
21
+    AmSession* onInvite(const AmSipRequest& req, const string& app_name,
21 22
 			AmArg& session_params);
22 23
 
23 24
 };
... ...
@@ -37,8 +38,9 @@ class EarlyRecordDialog
37 38
  public:
38 39
   EarlyRecordDialog(UACAuthCred* credentials);
39 40
   ~EarlyRecordDialog();
40
-  void onEarlySessionStart(const AmSipReply& req);
41
-  void onSessionStart(const AmSipReply& req);
41
+
42
+  void onEarlySessionStart();
43
+  void onSessionStart();
42 44
   void onBye(const AmSipRequest& req);
43 45
   inline UACAuthCred* getCredentials();
44 46
 };
... ...
@@ -51,7 +51,8 @@ int JukecallFactory::onLoad()
51 51
   return 0;
52 52
 }
53 53
 
54
-AmSession* JukecallFactory::onInvite(const AmSipRequest& req)
54
+AmSession* JukecallFactory::onInvite(const AmSipRequest& req, const string& app_name,
55
+				     const map<string,string>& app_params)
55 56
 {
56 57
   if (req.user.length() <= 3) {
57 58
     throw AmSession::Exception(403, "Need a number to call");
... ...
@@ -71,11 +72,11 @@ JukecallSession::~JukecallSession()
71 72
 {
72 73
 }
73 74
 
74
-void JukecallSession::onSessionStart(const AmSipRequest& req)
75
+void JukecallSession::onSessionStart()
75 76
 {
76 77
   if (state != JC_none) {
77 78
     // reinvite
78
-    AmB2ABCallerSession::onSessionStart(req);
79
+    AmB2ABCallerSession::onSessionStart();
79 80
     return;
80 81
   }
81 82
 
... ...
@@ -91,6 +92,8 @@ void JukecallSession::onSessionStart(const AmSipRequest& req)
91 92
   setOutput(&initial_announcement);
92 93
 
93 94
   state = JC_initial_announcement;
95
+
96
+  AmB2ABCallerSession::onSessionStart();
94 97
 }
95 98
 
96 99
 void JukecallSession::onDtmf(int event, int duration_msec) {
... ...
@@ -41,7 +41,8 @@ public:
41 41
 
42 42
   int onLoad();
43 43
 
44
-  AmSession* onInvite(const AmSipRequest& req);
44
+  AmSession* onInvite(const AmSipRequest& req, const string& app_name,
45
+		      const map<string,string>& app_params);
45 46
 };
46 47
 
47 48
 class JukecallSession 
... ...
@@ -71,7 +72,7 @@ public:
71 72
   JukecallSession();
72 73
   ~JukecallSession();
73 74
 
74
-  void onSessionStart(const AmSipRequest& req);
75
+  void onSessionStart();
75 76
   void process(AmEvent* event);
76 77
 
77 78
   void onDtmf(int event, int duration_msec);
... ...
@@ -83,14 +83,16 @@ int PinAuthConferenceFactory::onLoad()
83 83
   return 0;
84 84
 }
85 85
 
86
-// incoming calls - req is INVITE
87
-AmSession* PinAuthConferenceFactory::onInvite(const AmSipRequest& req)
86
+// incoming calls
87
+AmSession* PinAuthConferenceFactory::onInvite(const AmSipRequest&, const string& app_name,
88
+					      const map<string,string>& app_params)
88 89
 {
89 90
   return new PinAuthConferenceDialog(prompts);
90 91
 }
91 92
 
92
-// outgoing calls - rep is 200 class response to INVITE
93
-AmSession* PinAuthConferenceFactory::onInvite(const AmSipReply& rep)
93
+// outgoing calls
94
+AmSession* PinAuthConferenceFactory::onInvite(const AmSipRequest& req, const string& app_name,
95
+					      AmArg& session_params)
94 96
 {
95 97
   return new PinAuthConferenceDialog(prompts);
96 98
 }
... ...
@@ -134,7 +136,7 @@ void PinAuthConferenceDialog::connectConference(const string& room) {
134 136
   setInOut(&play_list,&play_list);
135 137
 }
136 138
 
137
-void PinAuthConferenceDialog::onSessionStart(const AmSipRequest& req)
139
+void PinAuthConferenceDialog::onSessionStart()
138 140
 { 
139 141
   state = EnteringPin;
140 142
 
... ...
@@ -142,6 +144,8 @@ void PinAuthConferenceDialog::onSessionStart(const AmSipRequest& req)
142 144
 
143 145
   // set the playlist as input and output
144 146
   setInOut(&play_list,&play_list);
147
+
148
+  AmSession::onSessionStart();
145 149
 }
146 150
  
147 151
 void PinAuthConferenceDialog::onBye(const AmSipRequest& req)
... ...
@@ -60,8 +60,10 @@ public:
60 60
   static PlayoutType m_PlayoutType;
61 61
 
62 62
   PinAuthConferenceFactory(const string& _app_name);
63
-  AmSession* onInvite(const AmSipRequest&);
64
-  AmSession* onInvite(const AmSipReply&);
63
+  AmSession* onInvite(const AmSipRequest&, const string& app_name,
64
+		      const map<string,string>& app_params);
65
+  AmSession* onInvite(const AmSipRequest& req, const string& app_name,
66
+		      AmArg& session_params);
65 67
   int onLoad();
66 68
 };
67 69
 
... ...
@@ -95,7 +97,7 @@ public:
95 97
   ~PinAuthConferenceDialog();
96 98
 
97 99
   void process(AmEvent* ev);
98
-  void onSessionStart(const AmSipRequest& req);
100
+  void onSessionStart();
99 101
   void onDtmf(int event, int duration);
100 102
   void onBye(const AmSipRequest& req);
101 103
 };
... ...
@@ -95,7 +95,8 @@ int ServiceLineFactory::onLoad()
95 95
   return 0;
96 96
 }
97 97
 
98
-AmSession* ServiceLineFactory::onInvite(const AmSipRequest& req)
98
+AmSession* ServiceLineFactory::onInvite(const AmSipRequest& req, const string& app_name,
99
+					const map<string,string>& app_params)
99 100
 {
100 101
   string announce_path = AnnouncePath;
101 102
   string announce_file = announce_path + req.domain
... ...
@@ -122,12 +123,11 @@ ServiceLineCallerDialog::ServiceLineCallerDialog(const string& filename)
122 123
 {
123 124
 }
124 125
 
125
-void ServiceLineCallerDialog::onSessionStart(const AmSipRequest& req)
126
+void ServiceLineCallerDialog::onSessionStart()
126 127
 {
127
-
128 128
   if (started) {
129 129
     // reinvite
130
-    AmB2ABCallerSession::onSessionStart(req);
130
+    AmB2ABCallerSession::onSessionStart();
131 131
     return;
132 132
   }
133 133
   started = true;
... ...
@@ -137,6 +137,8 @@ void ServiceLineCallerDialog::onSessionStart(const AmSipRequest& req)
137 137
   
138 138
   setInOut(&playlist, &playlist);
139 139
   playlist.addToPlaylist(new AmPlaylistItem(&wav_file, NULL));
140
+
141
+  AmB2ABCallerSession::onSessionStart();
140 142
 }
141 143
 
142 144
 void ServiceLineCallerDialog::process(AmEvent* event)
... ...
@@ -54,7 +54,8 @@ public:
54 54
   ServiceLineFactory(const string& _app_name);
55 55
 
56 56
   int onLoad();
57
-  AmSession* onInvite(const AmSipRequest& req);
57
+  AmSession* onInvite(const AmSipRequest& req, const string& app_name,
58
+		      const map<string,string>& app_params);
58 59
 };
59 60
 
60 61
 class ServiceLineCallerDialog: public AmB2ABCallerSession
... ...
@@ -75,7 +76,7 @@ public:
75 76
     
76 77
   void process(AmEvent* event);
77 78
   void onDtmf(int event, int duration);
78
-  void onSessionStart(const AmSipRequest& req);
79
+  void onSessionStart();
79 80
 
80 81
   virtual AmB2ABCalleeSession* createCalleeSession();
81 82
 };
... ...
@@ -43,13 +43,15 @@ int SimpleConferenceFactory::onLoad()
43 43
 }
44 44
 
45 45
 // incoming calls - req is INVITE
46
-AmSession* SimpleConferenceFactory::onInvite(const AmSipRequest& req)
46
+AmSession* SimpleConferenceFactory::onInvite(const AmSipRequest& req, const string& app_name,
47
+					     const map<string,string>& app_params)
47 48
 {
48 49
   return new SimpleConferenceDialog();
49 50
 }
50 51
 
51 52
 // outgoing calls - rep is 200 class response to INVITE
52
-AmSession* SimpleConferenceFactory::onInvite(const AmSipReply& rep)
53
+AmSession* SimpleConferenceFactory::onInvite(const AmSipRequest& req, const string& app_name,
54
+					     AmArg& session_params)
53 55
 {
54 56
   return new SimpleConferenceDialog();
55 57
 }
... ...
@@ -67,7 +69,7 @@ SimpleConferenceDialog::~SimpleConferenceDialog()
67 69
   play_list.close(false);
68 70
 }
69 71
 
70
-void SimpleConferenceDialog::onSessionStart(const AmSipRequest& req)
72
+void SimpleConferenceDialog::onSessionStart()
71 73
 {
72 74
   // set the conference id ('conference room') to user part of ruri
73 75
   conf_id = dlg.user;
... ...
@@ -92,6 +94,8 @@ void SimpleConferenceDialog::onSessionStart(const AmSipRequest& req)
92 94
   // people in the conference (important if we have multiple
93 95
   // MediaProcessor threads
94 96
   setCallgroup(conf_id);
97
+
98
+  AmSession::onSessionStart();
95 99
 }
96 100
 
97 101
 void SimpleConferenceDialog::onBye(const AmSipRequest& req)
... ...
@@ -47,8 +47,10 @@ class SimpleConferenceFactory : public AmSessionFactory
47 47
 {
48 48
 public:
49 49
   SimpleConferenceFactory(const string& _app_name);
50
-  AmSession* onInvite(const AmSipRequest&);
51
-  AmSession* onInvite(const AmSipReply&);
50
+  AmSession* onInvite(const AmSipRequest& req, const string& app_name,
51
+		      const map<string,string>& app_params);
52
+  AmSession* onInvite(const AmSipRequest& req, const string& app_name,
53
+		      AmArg& session_params);
52 54
   int onLoad();
53 55
 };
54 56
 
... ...
@@ -71,7 +73,7 @@ public:
71 73
   ~SimpleConferenceDialog();
72 74
 
73 75
   void process(AmEvent* ev);
74
-  void onSessionStart(const AmSipRequest& req);
76
+  void onSessionStart();
75 77
   void onDtmf(int event, int duration);
76 78
   void onBye(const AmSipRequest& req);
77 79
 };
... ...
@@ -33,7 +33,8 @@ int MyAnnounceAppFactory::onLoad()
33 33
     return 0;
34 34
 }
35 35
 
36
-AmSession* MyAnnounceAppFactory::onInvite(const AmSipRequest& req)
36
+AmSession* MyAnnounceAppFactory::onInvite(const AmSipRequest& req, const string& app_name,
37
+					  const map<string,string>& app_params)
37 38
 {
38 39
     return new MyAnnounceAppDialog();
39 40
 }
... ...
@@ -46,7 +47,7 @@ MyAnnounceAppDialog::~MyAnnounceAppDialog()
46 47
 {
47 48
 }
48 49
 
49
-void MyAnnounceAppDialog::onSessionStart(const AmSipRequest& req)
50
+void MyAnnounceAppDialog::onSessionStart()
50 51
 {
51 52
     DBG("MyAnnounceAppDialog::onSessionStart - file is '%s'\n", 
52 53
 	MyAnnounceAppFactory::AnnouncementFile.c_str());
... ...
@@ -56,6 +57,7 @@ void MyAnnounceAppDialog::onSessionStart(const AmSipRequest& req)
56 57
     
57 58
     setOutput(&wav_file);
58 59
 
60
+    AmSession::onSessionStart();
59 61
 }
60 62
 
61 63
 void MyAnnounceAppDialog::onBye(const AmSipRequest& req)
... ...
@@ -15,7 +15,8 @@ public:
15 15
     MyAnnounceAppFactory(const string& _app_name);
16 16
 
17 17
     int onLoad();
18
-    AmSession* onInvite(const AmSipRequest& req);
18
+    AmSession* onInvite(const AmSipRequest& req, const string& app_name,
19
+			const map<string,string>& app_params);
19 20
 };
20 21
 
21 22
 class MyAnnounceAppDialog : public AmSession
... ...
@@ -27,7 +28,7 @@ class MyAnnounceAppDialog : public AmSession
27 28
     MyAnnounceAppDialog();
28 29
     ~MyAnnounceAppDialog();
29 30
 
30
-    void onSessionStart(const AmSipRequest& req);
31
+    void onSessionStart();
31 32
     void onBye(const AmSipRequest& req);
32 33
 };
33 34
 
... ...
@@ -15,7 +15,8 @@ int MyAppFactory::onLoad()
15 15
     return 0;
16 16
 }
17 17
 
18
-AmSession* MyAppFactory::onInvite(const AmSipRequest& req)
18
+AmSession* MyAppFactory::onInvite(const AmSipRequest& req, const string& app_name,
19
+				  const map<string,string>& app_params)
19 20
 {
20 21
     return new MyAppDialog();
21 22
 }
... ...
@@ -28,7 +29,7 @@ MyAppDialog::~MyAppDialog()
28 29
 {
29 30
 }
30 31
 
31
-void MyAppDialog::onSessionStart(const AmSipRequest& req)
32
+void MyAppDialog::onSessionStart()
32 33
 {
33 34
     DBG("MyAppDialog::onSessionStart: Hello World!\n");
34 35
 }
... ...
@@ -9,7 +9,8 @@ public:
9 9
     MyAppFactory(const string& _app_name);
10 10
 
11 11
     int onLoad();
12
-    AmSession* onInvite(const AmSipRequest& req);
12
+    AmSession* onInvite(const AmSipRequest& req, const string& app_name,
13
+			const map<string,string>& app_params);
13 14
 };
14 15
 
15 16
 class MyAppDialog : public AmSession
... ...
@@ -19,7 +20,7 @@ class MyAppDialog : public AmSession
19 20
     MyAppDialog();
20 21
     ~MyAppDialog();
21 22
 
22
-    void onSessionStart(const AmSipRequest& req);
23
+    void onSessionStart();
23 24
     void onBye(const AmSipRequest& req);
24 25
 };
25 26
 
... ...
@@ -57,7 +57,8 @@ int MyCCFactory::onLoad()
57 57
   return 0;
58 58
 }
59 59
 
60
-AmSession* MyCCFactory::onInvite(const AmSipRequest& req)
60
+AmSession* MyCCFactory::onInvite(const AmSipRequest& req, const string& app_name,
61
+				 const map<string,string>& app_params)
61 62
 {
62 63
 
63 64
     AmDynInvoke* cc_acc = cc_acc_fact->getInstance();
... ...
@@ -97,16 +98,18 @@ void MyCCDialog::addToPlaylist(string fname) {
97 98
   }
98 99
 }
99 100
 
100
-void MyCCDialog::onSessionStart(const AmSipRequest& req)
101
+void MyCCDialog::onSessionStart()
101 102
 {
102 103
     DBG("MyCCDialog::onSessionStart");
103 104
     
104
-    AmB2BCallerSession::onSessionStart(req);
105
+    AmB2BCallerSession::onSessionStart();
105 106
 
106 107
     setInOut(&playlist, &playlist);
107 108
     addToPlaylist(MyCCFactory::InitialAnnouncement);
108 109
 
109 110
     setDtmfDetectionEnabled(true);
111
+
112
+    AmB2BCallerSession::onSessionStart();
110 113
 }
111 114
 
112 115
 void MyCCDialog::onDtmf(int event, int duration) {
... ...
@@ -24,7 +24,8 @@ public:
24 24
   MyCCFactory(const string& _app_name);
25 25
   
26 26
   int onLoad();
27
-  AmSession* onInvite(const AmSipRequest& req);
27
+  AmSession* onInvite(const AmSipRequest& req, const string& app_name,
28
+		      const map<string,string>& app_params);
28 29
 };
29 30
 
30 31
 class MyCCDialog : public AmB2BCallerSession
... ...
@@ -54,7 +55,7 @@ class MyCCDialog : public AmB2BCallerSession
54 55
     MyCCDialog(AmDynInvoke* cc_acc);
55 56
     ~MyCCDialog();
56 57
 
57
-    void onSessionStart(const AmSipRequest& req);
58
+    void onSessionStart();
58 59
     void onDtmf(int event, int duration);
59 60
     void process(AmEvent* ev);
60 61
     void onBye(const AmSipRequest& req);
... ...
@@ -33,7 +33,8 @@ int MyConfigurableAppFactory::onLoad()
33 33
     return 0;
34 34
 }
35 35
 
36
-AmSession* MyConfigurableAppFactory::onInvite(const AmSipRequest& req)
36
+AmSession* MyConfigurableAppFactory::onInvite(const AmSipRequest& req, const string& app_name,
37
+					      const map<string,string>& app_params)
37 38
 {
38 39
     return new MyConfigurableAppDialog();
39 40
 }
... ...
@@ -46,10 +47,12 @@ MyConfigurableAppDialog::~MyConfigurableAppDialog()
46 47
 {
47 48
 }
48 49
 
49
-void MyConfigurableAppDialog::onSessionStart(const AmSipRequest& req)
50
+void MyConfigurableAppDialog::onSessionStart()
50 51
 {
51 52
     DBG("MyConfigurableAppDialog::onSessionStart - file is '%s'\n", 
52 53
 	MyConfigurableAppFactory::AnnouncementFile.c_str());
54
+
55
+    AmSession::onSessionStart();
53 56
 }
54 57
 
55 58
 void MyConfigurableAppDialog::onBye(const AmSipRequest& req)
... ...
@@ -14,7 +14,8 @@ public:
14 14
     MyConfigurableAppFactory(const string& _app_name);
15 15
 
16 16
     int onLoad();
17
-    AmSession* onInvite(const AmSipRequest& req);
17
+    AmSession* onInvite(const AmSipRequest& req, const string& app_name,
18
+			const map<string,string>& app_params);
18 19
 };
19 20
 
20 21
 class MyConfigurableAppDialog : public AmSession
... ...
@@ -24,7 +25,7 @@ class MyConfigurableAppDialog : public AmSession
24 25
     MyConfigurableAppDialog();
25 26
     ~MyConfigurableAppDialog();
26 27
 
27
-    void onSessionStart(const AmSipRequest& req);
28
+    void onSessionStart();
28 29
     void onBye(const AmSipRequest& req);
29 30
 };
30 31
 
... ...
@@ -31,7 +31,8 @@ int MyJukeboxFactory::onLoad()
31 31
     return 0;
32 32
 }
33 33
 
34
-AmSession* MyJukeboxFactory::onInvite(const AmSipRequest& req)
34
+AmSession* MyJukeboxFactory::onInvite(const AmSipRequest& req, const string& app_name,
35
+				      const map<string,string>& app_params)
35 36
 {
36 37
     return new MyJukeboxDialog();
37 38
 }
... ...
@@ -51,7 +52,7 @@ MyJukeboxDialog::~MyJukeboxDialog()
51 52
     delete *it;
52 53
 }
53 54
 
54
-void MyJukeboxDialog::onSessionStart(const AmSipRequest& req)
55
+void MyJukeboxDialog::onSessionStart()
55 56
 {
56 57
     DBG("MyJukeboxDialog::onSessionStart - jukedir is '%s'\n", 
57 58
 	MyJukeboxFactory::JukeboxDir.c_str());
... ...
@@ -19,7 +19,8 @@ public:
19 19
     MyJukeboxFactory(const string& _app_name);
20 20
 
21 21
     int onLoad();
22
-    AmSession* onInvite(const AmSipRequest& req);
22
+    AmSession* onInvite(const AmSipRequest& req, const string& app_name,
23
+			const map<string,string>& app_params);
23 24
 };
24 25
 
25 26
 class MyJukeboxDialog : public AmSession
... ...
@@ -32,7 +33,7 @@ class MyJukeboxDialog : public AmSession
32 33
     MyJukeboxDialog();
33 34
     ~MyJukeboxDialog();
34 35
 
35
-    void onSessionStart(const AmSipRequest& req);
36
+    void onSessionStart();
36 37
     void onDtmf(int event, int duration);
37 38
     void process(AmEvent* ev);
38 39
     void onBye(const AmSipRequest& req);
... ...
@@ -89,7 +89,7 @@ AmAudioRtpFormat* PrecodedDialog::getNewRtpFormat() {
89 89
   return new AmPrecodedRtpFormat(*precoded_payload, m_payloads);
90 90
 }
91 91
 
92
-void PrecodedDialog::onSessionStart(const AmSipRequest& req)
92
+void PrecodedDialog::onSessionStart()
93 93
 {
94 94
   AmPrecodedFileInstance* file = file_def->getFileInstance(current_payload, 
95 95
 							   m_payloads);
... ...
@@ -105,6 +105,8 @@ void PrecodedDialog::onSessionStart(const AmSipRequest& req)
105 105
  
106 106
   setOutput(file);
107 107
   setReceiving(false);
108
+
109
+  AmSession::onSessionStart();
108 110
 }
109 111
 
110 112
 void PrecodedDialog::onBye(const AmSipRequest& req)
... ...
@@ -60,7 +60,7 @@ protected:
60 60
   PrecodedDialog(AmPrecodedFile* file_def);
61 61
   ~PrecodedDialog();
62 62
   
63
-  void onSessionStart(const AmSipRequest& req);
63
+  void onSessionStart();
64 64
   void onBye(const AmSipRequest& req);
65 65
 
66 66
   AmPayloadProviderInterface* getPayloadProvider();
... ...
@@ -89,6 +89,8 @@ void VoiceboxDialog::onSessionStart() {
89 89
 
90 90
   // set the playlist as input and output
91 91
   setInOut(&play_list,&play_list);
92
+
93
+  AmSession::onSessionStart();
92 94
 }
93 95
 
94 96
 void VoiceboxDialog::onBye(const AmSipRequest& req)
... ...
@@ -890,6 +890,7 @@ void AnswerMachineDialog::onSessionStart()
890 890
   sprintf(now, "%d", (int) time(NULL));
891 891
   email_dict["ts"] = now;
892 892
 
893
+  AmSession::onSessionStart();
893 894
 }
894 895
 
895 896
 void AnswerMachineDialog::onBye(const AmSipRequest& req)