Module: sems
Branch: master
Commit: 7b79658972bc9f8d748c13b816ad7175e3e2da2f
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=7b79658972bc9f8d748c13b816ad7175e3e2da2f

Author: Stefan Sayer <[email protected]>
Committer: Stefan Sayer <[email protected]>
Date:   Mon Jun 20 20:57:26 2011 +0200

fix call_gen to oa changes

---

 apps/examples/call_gen/CallGen.cpp      |   17 +++++++++++------
 apps/examples/call_gen/CallGen.h        |   10 +++++++---
 apps/examples/call_gen/etc/callgen.conf |    3 ++-
 3 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/apps/examples/call_gen/CallGen.cpp 
b/apps/examples/call_gen/CallGen.cpp
index aca140e..e849376 100644
--- a/apps/examples/call_gen/CallGen.cpp
+++ b/apps/examples/call_gen/CallGen.cpp
@@ -48,6 +48,7 @@ EXPORT_PLUGIN_CLASS_FACTORY(CallGenFactory,APP_NAME);
 
 string      CallGenFactory::DigitsDir;
 AmFileCache CallGenFactory::play_file;
+string      CallGenFactory::from_host;
 
 CallGenFactory::CallGenFactory(const string& _app_name)
   : AmSessionFactory(_app_name),
@@ -86,6 +87,8 @@ int CallGenFactory::load() {
     return -1;
   }
 
+  from_host = cfg.getParameter("from_host", "callgen.example.net");
+
   // get prompts
   AM_PROMPT_START;
   AM_PROMPT_END(prompts, cfg, APP_NAME);
@@ -161,14 +164,15 @@ void CallGenFactory::on_stop(){
   ERROR("not stoppable!\n");
 }
 
-AmSession* CallGenFactory::onInvite(const AmSipRequest& req)
-{
-  ERROR("DUH - need session params!.\n");
+AmSession* CallGenFactory::onInvite(const AmSipRequest& req, const string& 
app_name,
+                                   const map<string,string>& app_params) {
+  ERROR("incoming calls not supported!\n");
   return NULL;
 }
 
 // outgoing calls 
-AmSession* CallGenFactory::onInvite(const AmSipRequest& req, AmArg& args)
+AmSession* CallGenFactory::onInvite(const AmSipRequest& req, const string& 
app_name,
+                                   AmArg& args)
 {  
   size_t cnt = 0; 
   cnt++; // int    ncalls           = args.get(cnt++).asInt();
@@ -244,7 +248,7 @@ void CallGenFactory::createCall(const AmArg& args) {
   cnt++; // int    call_time_base   = args.get(cnt++).asInt();
   cnt++; // int    call_time_rand   = args.get(cnt++).asInt();
 
-  string from = "sip:callgen@"+AmConfig::LocalSIPIP;
+  string from = "sip:callgen@"+from_host;
   string call_ruri = "sip:"+ruri_user;
 
   for (int i=0;i<ruri_rand_digits;i++) 
@@ -390,7 +394,7 @@ void CallGenDialog::report(CallGenEvent what) {
                                         disconnect_ts);
 }
 
-void CallGenDialog::onSessionStart(const AmSipReply& rep) { 
+void CallGenDialog::onSessionStart() {
   time(&connect_ts);  
 
   report(CGConnect);
@@ -413,6 +417,7 @@ void CallGenDialog::onSessionStart(const AmSipReply& rep) {
     call_timer+=rand()%call_time_rand;
 
   if (call_timer > 0) {
+    DBG("setting timer %d %d\n", CALL_TIMER, call_timer);
     if (!setTimer(CALL_TIMER, call_timer)) {
       ERROR("could not load user_timer from session_timer plug-in\n");
       return;
diff --git a/apps/examples/call_gen/CallGen.h b/apps/examples/call_gen/CallGen.h
index 1a1cb23..2906a89 100644
--- a/apps/examples/call_gen/CallGen.h
+++ b/apps/examples/call_gen/CallGen.h
@@ -84,9 +84,13 @@ class CallGenFactory
 public:
   static string DigitsDir;
   static AmFileCache play_file;
+  static string from_host;
   CallGenFactory(const string& _app_name);
-  AmSession* onInvite(const AmSipRequest& req, AmArg& args);
-  AmSession* onInvite(const AmSipRequest& req);
+  AmSession* onInvite(const AmSipRequest& req, const string& app_name,
+                     const map<string,string>& app_params);
+  AmSession* onInvite(const AmSipRequest& req, const string& app_name,
+                     AmArg& args);
+
   int onLoad();
 
   // DI API
@@ -142,7 +146,7 @@ public:
   ~CallGenDialog();
 
   void onInvite(const AmSipRequest& r);
-  void onSessionStart(const AmSipReply& rep);
+  void onSessionStart();
   void onBye(const AmSipRequest& req);
   void process(AmEvent* event);
 };
diff --git a/apps/examples/call_gen/etc/callgen.conf 
b/apps/examples/call_gen/etc/callgen.conf
index 6801caf..5215dfb 100644
--- a/apps/examples/call_gen/etc/callgen.conf
+++ b/apps/examples/call_gen/etc/callgen.conf
@@ -1,2 +1,3 @@
 play_file=../apps/call_gen/wav/default.wav
-digits_dir=../apps/call_gen/wav/
\ No newline at end of file
+digits_dir=../apps/call_gen/wav/
+from_host=callgen.example.net
\ No newline at end of file

_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to