Browse code

b/f:conference: proper log if cfg file not found

Stefan Sayer authored on 11/11/2014 14:12:21
Showing 1 changed files
... ...
@@ -155,8 +155,11 @@ int get_audio_file(const string& message, const string& domain, const string& la
155 155
 
156 156
 int ConferenceFactory::onLoad()
157 157
 {
158
-  if(cfg.loadFile(AmConfig::ModConfigPath + string(APP_NAME)+ ".conf"))
158
+  if(cfg.loadFile(AmConfig::ModConfigPath + string(APP_NAME)+ ".conf")) {
159
+    ERROR("Configuration file '%s' missing.\n",
160
+	  (AmConfig::ModConfigPath + string(APP_NAME)+ ".conf").c_str());
159 161
     return -1;
162
+  }
160 163
 
161 164
   // get application specific global parameters
162 165
   configureModule(cfg);
Browse code

conference: update to 1.6 core

std::swap replaced by explicit string exchange

Václav Kubart authored on 12/02/2013 06:39:28 • Raphael Coeffic committed on 28/02/2013 12:11:27
Showing 1 changed files
... ...
@@ -886,18 +886,20 @@ void ConferenceDialog::onSipRequest(const AmSipRequest& req)
886 886
      (req.method != "REFER"))
887 887
     return;
888 888
 
889
-  std::swap(dlg->local_party,dlg->remote_party);
890
-  dlg->remote_tag = "";
889
+  string local_party(dlg->getLocalParty());
890
+  dlg->setLocalParty(dlg->getRemoteParty());
891
+  dlg->setRemoteParty(local_party);
892
+  dlg->setRemoteTag("");
891 893
 
892 894
   // get route set and next hop
893 895
   string iptel_app_param = getHeader(req.hdrs, PARAM_HDR, true);
894 896
   if (iptel_app_param.length()) {
895
-    dlg->route = get_header_keyvalue(iptel_app_param,"Transfer-RR");
897
+    dlg->setRouteSet(get_header_keyvalue(iptel_app_param,"Transfer-RR"));
896 898
   } else {
897 899
     INFO("Use of P-Transfer-RR/P-Transfer-NH is deprecated. "
898 900
 	 "Use '%s: Transfer-RR=<rr>;Transfer-NH=<nh>' instead.\n",PARAM_HDR);
899 901
 
900
-    dlg->route = getHeader(req.hdrs,"P-Transfer-RR", true);
902
+    dlg->setRouteSet(getHeader(req.hdrs,"P-Transfer-RR", true));
901 903
   }
902 904
 
903 905
   DBG("ConferenceDialog::onSipRequest: local_party = %s\n",dlg->getLocalParty().c_str());
Browse code

update apps to 1.6 core

Václav Kubart authored on 08/02/2013 16:02:28 • Raphael Coeffic committed on 28/02/2013 12:11:27
Showing 1 changed files
... ...
@@ -361,11 +361,11 @@ AmSession* ConferenceFactory::onRefer(const AmSipRequest& req, const string& app
361 361
     throw AmSession::Exception(488,"Not accepted here");
362 362
 
363 363
   AmSession* s = new ConferenceDialog(req.user);
364
-  s->dlg->local_tag  = req.from_tag;
364
+  s->dlg->setLocalTag(req.from_tag);
365 365
   
366 366
   setupSessionTimer(s);
367 367
 
368
-  DBG("ConferenceFactory::onRefer: local_tag = %s\n",s->dlg->local_tag.c_str());
368
+  DBG("ConferenceFactory::onRefer: local_tag = %s\n",s->dlg->getLocalTag().c_str());
369 369
 
370 370
   return s;
371 371
 }
... ...
@@ -716,7 +716,7 @@ void ConferenceDialog::onDtmf(int event, int duration)
716 716
   DBG("ConferenceDialog::onDtmf\n");
717 717
   if (dialedout || !allow_dialout ||
718 718
       ((ConferenceFactory::MaxParticipants > 0) &&
719
-       (AmConferenceStatus::getConferenceSize(dlg->user) >= 
719
+       (AmConferenceStatus::getConferenceSize(dlg->getUser()) >= 
720 720
 	ConferenceFactory::MaxParticipants)))
721 721
     return;
722 722
 
... ...
@@ -811,16 +811,16 @@ void ConferenceDialog::createDialoutParticipant(const string& uri_user)
811 811
 
812 812
   AmSipDialog* dialout_dlg = dialout_session->dlg;
813 813
 
814
-  dialout_dlg->local_tag    = dialout_id;
815
-  dialout_dlg->callid       = AmSession::getNewId();
814
+  dialout_dlg->setLocalTag(dialout_id);
815
+  dialout_dlg->setCallid(AmSession::getNewId());
816 816
 
817 817
   if (from_header.length() > 0) {
818
-    dialout_dlg->local_party  = from_header;
818
+    dialout_dlg->setLocalParty(from_header);
819 819
   } else {
820
-    dialout_dlg->local_party  = dlg->local_party;
820
+    dialout_dlg->setLocalParty(dlg->getLocalParty());
821 821
   }
822
-  dialout_dlg->remote_party = uri;
823
-  dialout_dlg->remote_uri   = uri;
822
+  dialout_dlg->setRemoteParty(uri);
823
+  dialout_dlg->setRemoteUri(uri);
824 824
 
825 825
   dialout_dlg->sendRequest(SIP_METH_INVITE,NULL,
826 826
 			  extra_headers);
... ...
@@ -900,10 +900,10 @@ void ConferenceDialog::onSipRequest(const AmSipRequest& req)
900 900
     dlg->route = getHeader(req.hdrs,"P-Transfer-RR", true);
901 901
   }
902 902
 
903
-  DBG("ConferenceDialog::onSipRequest: local_party = %s\n",dlg->local_party.c_str());
904
-  DBG("ConferenceDialog::onSipRequest: local_tag = %s\n",dlg->local_tag.c_str());
905
-  DBG("ConferenceDialog::onSipRequest: remote_party = %s\n",dlg->remote_party.c_str());
906
-  DBG("ConferenceDialog::onSipRequest: remote_tag = %s\n",dlg->remote_tag.c_str());
903
+  DBG("ConferenceDialog::onSipRequest: local_party = %s\n",dlg->getLocalParty().c_str());
904
+  DBG("ConferenceDialog::onSipRequest: local_tag = %s\n",dlg->getLocalTag().c_str());
905
+  DBG("ConferenceDialog::onSipRequest: remote_party = %s\n",dlg->getRemoteParty().c_str());
906
+  DBG("ConferenceDialog::onSipRequest: remote_tag = %s\n",dlg->getRemoteTag().c_str());
907 907
 
908 908
   dlg->sendRequest(SIP_METH_INVITE);
909 909
 
Browse code

changed sip dialog attribute in AmSession into a pointer.

Raphael Coeffic authored on 07/01/2013 16:27:13
Showing 1 changed files
... ...
@@ -361,11 +361,11 @@ AmSession* ConferenceFactory::onRefer(const AmSipRequest& req, const string& app
361 361
     throw AmSession::Exception(488,"Not accepted here");
362 362
 
363 363
   AmSession* s = new ConferenceDialog(req.user);
364
-  s->dlg.local_tag  = req.from_tag;
364
+  s->dlg->local_tag  = req.from_tag;
365 365
   
366 366
   setupSessionTimer(s);
367 367
 
368
-  DBG("ConferenceFactory::onRefer: local_tag = %s\n",s->dlg.local_tag.c_str());
368
+  DBG("ConferenceFactory::onRefer: local_tag = %s\n",s->dlg->local_tag.c_str());
369 369
 
370 370
   return s;
371 371
 }
... ...
@@ -407,7 +407,7 @@ void ConferenceDialog::onStart() {
407 407
 
408 408
 void ConferenceDialog::onInvite(const AmSipRequest& req)
409 409
 {
410
-  if(dlg.getStatus() == AmSipDialog::Connected){
410
+  if(dlg->getStatus() == AmSipDialog::Connected){
411 411
     AmSession::onInvite(req);  
412 412
     return;
413 413
   }
... ...
@@ -637,7 +637,7 @@ void ConferenceDialog::process(AmEvent* ev)
637 637
 	
638 638
       case DoConfDisconnect:
639 639
 		
640
-	dlg.bye();
640
+	dlg->bye();
641 641
 	closeChannels();
642 642
 	setStopped();
643 643
 	break;
... ...
@@ -716,7 +716,7 @@ void ConferenceDialog::onDtmf(int event, int duration)
716 716
   DBG("ConferenceDialog::onDtmf\n");
717 717
   if (dialedout || !allow_dialout ||
718 718
       ((ConferenceFactory::MaxParticipants > 0) &&
719
-       (AmConferenceStatus::getConferenceSize(dlg.user) >= 
719
+       (AmConferenceStatus::getConferenceSize(dlg->user) >= 
720 720
 	ConferenceFactory::MaxParticipants)))
721 721
     return;
722 722
 
... ...
@@ -809,20 +809,20 @@ void ConferenceDialog::createDialoutParticipant(const string& uri_user)
809 809
 
810 810
   ConferenceFactory::setupSessionTimer(dialout_session);
811 811
 
812
-  AmSipDialog& dialout_dlg = dialout_session->dlg;
812
+  AmSipDialog* dialout_dlg = dialout_session->dlg;
813 813
 
814
-  dialout_dlg.local_tag    = dialout_id;
815
-  dialout_dlg.callid       = AmSession::getNewId();
814
+  dialout_dlg->local_tag    = dialout_id;
815
+  dialout_dlg->callid       = AmSession::getNewId();
816 816
 
817 817
   if (from_header.length() > 0) {
818
-    dialout_dlg.local_party  = from_header;
818
+    dialout_dlg->local_party  = from_header;
819 819
   } else {
820
-    dialout_dlg.local_party  = dlg.local_party;
820
+    dialout_dlg->local_party  = dlg->local_party;
821 821
   }
822
-  dialout_dlg.remote_party = uri;
823
-  dialout_dlg.remote_uri   = uri;
822
+  dialout_dlg->remote_party = uri;
823
+  dialout_dlg->remote_uri   = uri;
824 824
 
825
-  dialout_dlg.sendRequest(SIP_METH_INVITE,NULL,
825
+  dialout_dlg->sendRequest(SIP_METH_INVITE,NULL,
826 826
 			  extra_headers);
827 827
 
828 828
   dialout_session->start();
... ...
@@ -882,30 +882,30 @@ void ConferenceDialog::closeChannels()
882 882
 void ConferenceDialog::onSipRequest(const AmSipRequest& req)
883 883
 {
884 884
   AmSession::onSipRequest(req);
885
-  if((dlg.getStatus() >= AmSipDialog::Connected) ||
885
+  if((dlg->getStatus() >= AmSipDialog::Connected) ||
886 886
      (req.method != "REFER"))
887 887
     return;
888 888
 
889
-  std::swap(dlg.local_party,dlg.remote_party);
890
-  dlg.remote_tag = "";
889
+  std::swap(dlg->local_party,dlg->remote_party);
890
+  dlg->remote_tag = "";
891 891
 
892 892
   // get route set and next hop
893 893
   string iptel_app_param = getHeader(req.hdrs, PARAM_HDR, true);
894 894
   if (iptel_app_param.length()) {
895
-    dlg.route = get_header_keyvalue(iptel_app_param,"Transfer-RR");
895
+    dlg->route = get_header_keyvalue(iptel_app_param,"Transfer-RR");
896 896
   } else {
897 897
     INFO("Use of P-Transfer-RR/P-Transfer-NH is deprecated. "
898 898
 	 "Use '%s: Transfer-RR=<rr>;Transfer-NH=<nh>' instead.\n",PARAM_HDR);
899 899
 
900
-    dlg.route = getHeader(req.hdrs,"P-Transfer-RR", true);
900
+    dlg->route = getHeader(req.hdrs,"P-Transfer-RR", true);
901 901
   }
902 902
 
903
-  DBG("ConferenceDialog::onSipRequest: local_party = %s\n",dlg.local_party.c_str());
904
-  DBG("ConferenceDialog::onSipRequest: local_tag = %s\n",dlg.local_tag.c_str());
905
-  DBG("ConferenceDialog::onSipRequest: remote_party = %s\n",dlg.remote_party.c_str());
906
-  DBG("ConferenceDialog::onSipRequest: remote_tag = %s\n",dlg.remote_tag.c_str());
903
+  DBG("ConferenceDialog::onSipRequest: local_party = %s\n",dlg->local_party.c_str());
904
+  DBG("ConferenceDialog::onSipRequest: local_tag = %s\n",dlg->local_tag.c_str());
905
+  DBG("ConferenceDialog::onSipRequest: remote_party = %s\n",dlg->remote_party.c_str());
906
+  DBG("ConferenceDialog::onSipRequest: remote_tag = %s\n",dlg->remote_tag.c_str());
907 907
 
908
-  dlg.sendRequest(SIP_METH_INVITE);
908
+  dlg->sendRequest(SIP_METH_INVITE);
909 909
 
910 910
   transfer_req.reset(new AmSipRequest(req));
911 911
 
... ...
@@ -919,7 +919,7 @@ void ConferenceDialog::onSipReply(const AmSipRequest& req,
919 919
   AmSession::onSipReply(req, reply, old_dlg_status);
920 920
 
921 921
   DBG("ConferenceDialog::onSipReply: code = %i, reason = %s\n, status = %i\n",
922
-      reply.code,reply.reason.c_str(),dlg.getStatus());
922
+      reply.code,reply.reason.c_str(),dlg->getStatus());
923 923
     
924 924
   if(!dialedout /*&& !transfer_req.get()*/)
925 925
     return;
... ...
@@ -927,7 +927,7 @@ void ConferenceDialog::onSipReply(const AmSipRequest& req,
927 927
   if((old_dlg_status < AmSipDialog::Connected) &&
928 928
      (reply.cseq_method == SIP_METH_INVITE)){
929 929
 
930
-    switch(dlg.getStatus()){
930
+    switch(dlg->getStatus()){
931 931
 
932 932
     case AmSipDialog::Proceeding:
933 933
     case AmSipDialog::Early:
... ...
@@ -964,7 +964,7 @@ void ConferenceDialog::onSipReply(const AmSipRequest& req,
964 964
 
965 965
       // }
966 966
       // else {
967
-      // 	dlg.reply(*(transfer_req.get()),reply.code,reply.reason);
967
+      // 	dlg->reply(*(transfer_req.get()),reply.code,reply.reason);
968 968
       // 	transfer_req.reset(0);
969 969
       // 	setStopped();
970 970
       // }
Browse code

align to new AmBasicSipEventHandler interface

Raphael Coeffic authored on 18/12/2012 17:00:07
Showing 1 changed files
... ...
@@ -912,9 +912,11 @@ void ConferenceDialog::onSipRequest(const AmSipRequest& req)
912 912
   return;
913 913
 }
914 914
 
915
-void ConferenceDialog::onSipReply(const AmSipReply& reply, AmSipDialog::Status old_dlg_status)
915
+void ConferenceDialog::onSipReply(const AmSipRequest& req,
916
+				  const AmSipReply& reply, 
917
+				  AmBasicSipDialog::Status old_dlg_status)
916 918
 {
917
-  AmSession::onSipReply(reply, old_dlg_status);
919
+  AmSession::onSipReply(req, reply, old_dlg_status);
918 920
 
919 921
   DBG("ConferenceDialog::onSipReply: code = %i, reason = %s\n, status = %i\n",
920 922
       reply.code,reply.reason.c_str(),dlg.getStatus());
Browse code

adds support for wideband audio

Raphael Coeffic authored on 21/02/2012 17:26:22
Showing 1 changed files
... ...
@@ -544,7 +544,7 @@ void ConferenceDialog::setupAudio()
544 544
   }
545 545
   else {
546 546
 
547
-    channel.reset(AmConferenceStatus::getChannel(conf_id,getLocalTag()));
547
+    channel.reset(AmConferenceStatus::getChannel(conf_id,getLocalTag(),RTPStream()->getSampleRate()));
548 548
 
549 549
     if (listen_only) {
550 550
 	play_list.addToPlaylist(new AmPlaylistItem(channel.get(),
... ...
@@ -798,14 +798,14 @@ void ConferenceDialog::createDialoutParticipant(const string& uri_user)
798 798
 
799 799
   uri = "sip:" + uri_user + dialout_suffix;
800 800
 
801
-  dialout_channel.reset(AmConferenceStatus::getChannel(getLocalTag(),getLocalTag()));
801
+  dialout_channel.reset(AmConferenceStatus::getChannel(getLocalTag(),getLocalTag(),RTPStream()->getSampleRate()));
802 802
 
803 803
   dialout_id = AmSession::getNewId();
804 804
     
805 805
   ConferenceDialog* dialout_session = 
806 806
     new ConferenceDialog(conf_id,
807 807
 			 AmConferenceStatus::getChannel(getLocalTag(),
808
-							dialout_id));
808
+							dialout_id,RTPStream()->getSampleRate()));
809 809
 
810 810
   ConferenceFactory::setupSessionTimer(dialout_session);
811 811
 
... ...
@@ -865,7 +865,7 @@ void ConferenceDialog::connectMainChannel()
865 865
   if(!channel.get())
866 866
     channel.reset(AmConferenceStatus
867 867
 		  ::getChannel(conf_id,
868
-			       getLocalTag()));
868
+			       getLocalTag(),RTPStream()->getSampleRate()));
869 869
 
870 870
   play_list.addToPlaylist(new AmPlaylistItem(channel.get(),
871 871
 					     channel.get()));
Browse code

b/f: conference: fix onRefer.

Raphael Coeffic authored on 23/02/2012 13:29:43
Showing 1 changed files
... ...
@@ -354,7 +354,8 @@ void ConferenceFactory::setupSessionTimer(AmSession* s) {
354 354
   }
355 355
 }
356 356
 
357
-AmSession* ConferenceFactory::onRefer(const AmSipRequest& req, const string& app_name)
357
+AmSession* ConferenceFactory::onRefer(const AmSipRequest& req, const string& app_name,
358
+				      const map<string,string>& app_params)
358 359
 {
359 360
   if(req.to_tag.empty())
360 361
     throw AmSession::Exception(488,"Not accepted here");
Browse code

b/f: avoid to hide AmAudio::close() with AmPlaylist::close(…)

- AmPlaylist::close(…) is now replaced by AmPlaylist::flush().
- AmAudio::noAudio event is only sent if the play-cursor reaches the end (not through flush() or close()).

Raphael Coeffic authored on 22/02/2012 12:18:03
Showing 1 changed files
... ...
@@ -390,7 +390,7 @@ ConferenceDialog::~ConferenceDialog()
390 390
   DBG("ConferenceDialog::~ConferenceDialog()\n");
391 391
 
392 392
   // clean playlist items
393
-  play_list.close(false);
393
+  play_list.flush();
394 394
 
395 395
 #ifdef WITH_SAS_TTS
396 396
   // garbage collect tts files - TODO: delete files
... ...
@@ -529,7 +529,7 @@ void ConferenceDialog::setupAudio()
529 529
   }
530 530
 
531 531
 
532
-  play_list.close();// !!!
532
+  play_list.flush();
533 533
 
534 534
   if(dialout_channel.get()){
535 535
 
... ...
@@ -660,7 +660,7 @@ void ConferenceDialog::process(AmEvent* ev)
660 660
 
661 661
 	state = CS_dialout_connected;
662 662
 
663
-	play_list.close(); // !!!
663
+	play_list.flush();
664 664
 	play_list.addToPlaylist(new AmPlaylistItem(dialout_channel.get(),
665 665
 						   dialout_channel.get()));
666 666
 	break;
... ...
@@ -671,7 +671,7 @@ void ConferenceDialog::process(AmEvent* ev)
671 671
 	  RingTone.reset(new AmRingTone(0,2000,4000,440,480)); // US
672 672
 
673 673
 	DBG("adding ring tone to the playlist (dialedout = %i)\n",dialedout);
674
-	play_list.close();
674
+	play_list.flush();
675 675
 	play_list.addToPlaylist(new AmPlaylistItem(RingTone.get(),NULL));
676 676
 	break;
677 677
 
... ...
@@ -682,7 +682,6 @@ void ConferenceDialog::process(AmEvent* ev)
682 682
 	  ErrorTone.reset(new AmRingTone(2000,250,250,440,480));
683 683
 
684 684
 	DBG("adding error tone to the playlist (dialedout = %i)\n",dialedout);
685
-	//play_list.close();
686 685
 	play_list.addToPlayListFront(new AmPlaylistItem(ErrorTone.get(),NULL));
687 686
 	break;
688 687
 		
... ...
@@ -860,7 +859,7 @@ void ConferenceDialog::connectMainChannel()
860 859
   dialedout = false;
861 860
   dialout_channel.reset(NULL);
862 861
     
863
-  play_list.close();
862
+  play_list.flush();
864 863
 
865 864
   if(!channel.get())
866 865
     channel.reset(AmConferenceStatus
... ...
@@ -873,7 +872,7 @@ void ConferenceDialog::connectMainChannel()
873 872
 
874 873
 void ConferenceDialog::closeChannels()
875 874
 {
876
-  play_list.close();
875
+  play_list.flush();
877 876
   setInOut(NULL,NULL);
878 877
   channel.reset(NULL);
879 878
   dialout_channel.reset(NULL);
Browse code

multi-mime: plugins: adapt to core API changes.

Raphael Coeffic authored on 20/02/2012 09:10:35
Showing 1 changed files
... ...
@@ -822,7 +822,7 @@ void ConferenceDialog::createDialoutParticipant(const string& uri_user)
822 822
   dialout_dlg.remote_party = uri;
823 823
   dialout_dlg.remote_uri   = uri;
824 824
 
825
-  dialout_dlg.sendRequest(SIP_METH_INVITE,"","",
825
+  dialout_dlg.sendRequest(SIP_METH_INVITE,NULL,
826 826
 			  extra_headers);
827 827
 
828 828
   dialout_session->start();
Browse code

apps/conference: added Listen-Only P-App-Param

- For the purpose of joining a conference in "listen only" mode.

Juha Heinanen authored on 12/12/2011 09:35:21
Showing 1 changed files
... ...
@@ -415,11 +415,13 @@ void ConferenceDialog::onInvite(const AmSipRequest& req)
415 415
   string lonely_user_file;
416 416
 
417 417
   string app_param_hdr = getHeader(req.hdrs, PARAM_HDR, true);
418
+  string listen_only_str = "";
418 419
   if (app_param_hdr.length()) {
419 420
     from_header = get_header_keyvalue(app_param_hdr, "Dialout-From");
420 421
     extra_headers = get_header_keyvalue(app_param_hdr, "Dialout-Extra");
421 422
     dialout_suffix = get_header_keyvalue(app_param_hdr, "Dialout-Suffix");      
422
-    language = get_header_keyvalue(app_param_hdr, "Language");      
423
+    language = get_header_keyvalue(app_param_hdr, "Language");
424
+    listen_only_str = get_header_keyvalue(app_param_hdr, "Listen-Only");
423 425
   } else {
424 426
     from_header = getHeader(req.hdrs, "P-Dialout-From", true);
425 427
     extra_headers = getHeader(req.hdrs, "P-Dialout-Extra", true);
... ...
@@ -454,6 +456,8 @@ void ConferenceDialog::onInvite(const AmSipRequest& req)
454 456
     
455 457
   allow_dialout = dialout_suffix.length() > 0;
456 458
 
459
+  listen_only = listen_only_str.length() > 0;
460
+
457 461
   if (!language.empty()) {
458 462
 
459 463
 #ifdef USE_MYSQL
... ...
@@ -530,15 +534,24 @@ void ConferenceDialog::setupAudio()
530 534
   if(dialout_channel.get()){
531 535
 
532 536
     DBG("adding dialout_channel to the playlist (dialedout = %i)\n",dialedout);
533
-    play_list.addToPlaylist(new AmPlaylistItem(dialout_channel.get(),
534
-					       dialout_channel.get()));
537
+    if (listen_only)
538
+	play_list.addToPlaylist(new AmPlaylistItem(dialout_channel.get(),
539
+						   (AmAudio*)NULL));
540
+    else
541
+	play_list.addToPlaylist(new AmPlaylistItem(dialout_channel.get(),
542
+						   dialout_channel.get()));
535 543
   }
536 544
   else {
537 545
 
538 546
     channel.reset(AmConferenceStatus::getChannel(conf_id,getLocalTag()));
539 547
 
540
-    play_list.addToPlaylist(new AmPlaylistItem(channel.get(),
541
-					       channel.get()));
548
+    if (listen_only) {
549
+	play_list.addToPlaylist(new AmPlaylistItem(channel.get(),
550
+						   (AmAudio*)NULL));
551
+    }
552
+    else
553
+	play_list.addToPlaylist(new AmPlaylistItem(channel.get(),
554
+						   channel.get()));
542 555
   }
543 556
 
544 557
   setInOut(&play_list,&play_list);
Browse code

b/f: conference re-invite.

Raphael Coeffic authored on 31/10/2011 10:12:43
Showing 1 changed files
... ...
@@ -406,8 +406,10 @@ void ConferenceDialog::onStart() {
406 406
 
407 407
 void ConferenceDialog::onInvite(const AmSipRequest& req)
408 408
 {
409
-  if(dlg.getStatus() == AmSipDialog::Connected)
409
+  if(dlg.getStatus() == AmSipDialog::Connected){
410
+    AmSession::onInvite(req);  
410 411
     return;
412
+  }
411 413
 
412 414
   int i, len;
413 415
   string lonely_user_file;
Browse code

b/f: conference dialout.

Raphael Coeffic authored on 26/10/2011 15:03:11
Showing 1 changed files
... ...
@@ -406,8 +406,6 @@ void ConferenceDialog::onStart() {
406 406
 
407 407
 void ConferenceDialog::onInvite(const AmSipRequest& req)
408 408
 {
409
-  AmSession::onInvite(req);
410
-  
411 409
   if(dlg.getStatus() == AmSipDialog::Connected)
412 410
     return;
413 411
 
... ...
@@ -487,11 +485,22 @@ void ConferenceDialog::onInvite(const AmSipRequest& req)
487 485
 
488 486
   DBG("Using LonelyUserFile <%s>\n",
489 487
       ConferenceFactory::LonelyUserFile.c_str());
488
+
489
+  AmSession::onInvite(req);  
490 490
 }
491 491
 
492 492
 void ConferenceDialog::onSessionStart()
493 493
 {
494 494
   setupAudio();
495
+
496
+  if(dialedout) {
497
+    // send connect event
498
+    AmSessionContainer::instance()
499
+      ->postEvent(dialout_channel->getConfID(),
500
+		  new DialoutConfEvent(DoConfConnect,
501
+				       dialout_channel->getConfID()));
502
+  }
503
+
495 504
   AmSession::onSessionStart();
496 505
 }
497 506
 
... ...
@@ -890,106 +899,63 @@ void ConferenceDialog::onSipRequest(const AmSipRequest& req)
890 899
 
891 900
 void ConferenceDialog::onSipReply(const AmSipReply& reply, AmSipDialog::Status old_dlg_status)
892 901
 {
893
-  //int status = dlg.getStatus();
894 902
   AmSession::onSipReply(reply, old_dlg_status);
895 903
 
896 904
   DBG("ConferenceDialog::onSipReply: code = %i, reason = %s\n, status = %i\n",
897 905
       reply.code,reply.reason.c_str(),dlg.getStatus());
898 906
     
899
-  if(!dialedout && 
900
-     !transfer_req.get())
907
+  if(!dialedout /*&& !transfer_req.get()*/)
901 908
     return;
902 909
 
903
-  /*
904
-  if(status < AmSipDialog::Connected){
910
+  if((old_dlg_status < AmSipDialog::Connected) &&
911
+     (reply.cseq_method == SIP_METH_INVITE)){
905 912
 
906 913
     switch(dlg.getStatus()){
907 914
 
908
-    case AmSipDialog::Connected:
909
-
910
-      // connected!
911
-      try {
912
-
913
-	acceptAudio(reply.body,reply.hdrs);
914
-
915
-	if(getDetached() && !getStopped()){
916
-		    
917
-	  setupAudio();
918
-		    
919
-	  if(getInput() || getOutput())
920
-	    AmMediaProcessor::instance()->addSession(this,
921
-						     getCallgroup()); 
922
-	  else { 
923
-	    ERROR("missing audio input and/or ouput.\n");
924
-	    return;
925
-	  }
926
-
927
-	  if(!transfer_req.get()){
928
-
929
-	    // send connect event
930
-	    AmSessionContainer::instance()
931
-	      ->postEvent(dialout_channel->getConfID(),
932
-			  new DialoutConfEvent(DoConfConnect,
933
-					       dialout_channel->getConfID()));
934
-	  }
935
-	  else {
936
-	    dlg.reply(*(transfer_req.get()),202,"Accepted");
937
-	    transfer_req.reset(0);
938
-	    connectMainChannel();
939
-	  }
940
-	} 
941
-	
942
-      }
943
-      catch(const AmSession::Exception& e){
944
-	ERROR("%i %s\n",e.code,e.reason.c_str());
945
-	dlg.bye();
946
-	setStopped();
947
-      }
948
-      break;
949
-
950
-    case AmSipDialog::Pending:
915
+    case AmSipDialog::Proceeding:
916
+    case AmSipDialog::Early:
951 917
 
952 918
       switch(reply.code){
953 919
       case 180:
920
+      case 183: break;//TODO: remote ring tone.
954 921
 
955
-	// send ringing event
956
-	AmSessionContainer::instance()
957
-	  ->postEvent(dialout_channel->getConfID(),
958
-		      new DialoutConfEvent(DoConfRinging,
959
-					   dialout_channel->getConfID()));
922
+	if(dialout_channel.get()){
923
+	  // send ringing event
924
+	  AmSessionContainer::instance()
925
+	    ->postEvent(dialout_channel->getConfID(),
926
+			new DialoutConfEvent(DoConfRinging,
927
+					     dialout_channel->getConfID()));
928
+	}
960 929
 		
961 930
 	break;
962
-      case 183: break;//TODO: remote ring tone.
963 931
       default:  break;// continue waiting.
964 932
       }
965 933
       break;
966 934
 
967 935
     case AmSipDialog::Disconnected:
968 936
 
969
-      if(!transfer_req.get()){
970
-
937
+      // if(!transfer_req.get()){
938
+      
939
+      if(dialout_channel.get()){
971 940
 	disconnectDialout();
972
-	//switch(reply.code){
973
-	//default:
974
-	    
975 941
 	AmSessionContainer::instance()
976 942
 	  ->postEvent(dialout_channel->getConfID(),
977 943
 		      new DialoutConfEvent(DoConfError,
978 944
 					   dialout_channel->getConfID()));
979
-	//}
980
-      }
981
-      else {
982
-		
983
-	dlg.reply(*(transfer_req.get()),reply.code,reply.reason);
984
-	transfer_req.reset(0);
985
-	setStopped();
986 945
       }
946
+      setStopped();
947
+
948
+      // }
949
+      // else {
950
+      // 	dlg.reply(*(transfer_req.get()),reply.code,reply.reason);
951
+      // 	transfer_req.reset(0);
952
+      // 	setStopped();
953
+      // }
987 954
       break;
988 955
 
989 956
     default: break;
990 957
     }
991 958
   }
992
-  */
993 959
 }
994 960
 
995 961
 #ifdef WITH_SAS_TTS
Browse code

b/f: conference dial-in

Raphael Coeffic authored on 24/10/2011 14:58:16
Showing 1 changed files
... ...
@@ -406,6 +406,8 @@ void ConferenceDialog::onStart() {
406 406
 
407 407
 void ConferenceDialog::onInvite(const AmSipRequest& req)
408 408
 {
409
+  AmSession::onInvite(req);
410
+  
409 411
   if(dlg.getStatus() == AmSipDialog::Connected)
410 412
     return;
411 413
 
... ...
@@ -490,6 +492,7 @@ void ConferenceDialog::onInvite(const AmSipRequest& req)
490 492
 void ConferenceDialog::onSessionStart()
491 493
 {
492 494
   setupAudio();
495
+  AmSession::onSessionStart();
493 496
 }
494 497
 
495 498
 void ConferenceDialog::setupAudio()
Browse code

adapt to new on[Early]SessionStart behavior

Raphael Coeffic authored on 14/07/2011 14:04:49
Showing 1 changed files
... ...
@@ -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
 {
Browse code

wip: adds parsed session parameters extracted from the P-App-Param HF.

Raphael Coeffic authored on 25/05/2011 14:32:10
Showing 1 changed files
... ...
@@ -308,7 +308,8 @@ int ConferenceFactory::onLoad()
308 308
   return 0;
309 309
 }
310 310
 
311
-AmSession* ConferenceFactory::onInvite(const AmSipRequest& req, const string& app_name)
311
+AmSession* ConferenceFactory::onInvite(const AmSipRequest& req, const string& app_name,
312
+				       const map<string,string>& app_params)
312 313
 {
313 314
   if ((ConferenceFactory::MaxParticipants > 0) &&
314 315
       (AmConferenceStatus::getConferenceSize(req.user) >=
Browse code

propagate app_name to everywhere it is needed.

Raphael Coeffic authored on 10/05/2011 14:36:36
Showing 1 changed files
... ...
@@ -308,7 +308,7 @@ int ConferenceFactory::onLoad()
308 308
   return 0;
309 309
 }
310 310
 
311
-AmSession* ConferenceFactory::onInvite(const AmSipRequest& req)
311
+AmSession* ConferenceFactory::onInvite(const AmSipRequest& req, const string& app_name)
312 312
 {
313 313
   if ((ConferenceFactory::MaxParticipants > 0) &&
314 314
       (AmConferenceStatus::getConferenceSize(req.user) >=
... ...
@@ -353,7 +353,7 @@ void ConferenceFactory::setupSessionTimer(AmSession* s) {
353 353
   }
354 354
 }
355 355
 
356
-AmSession* ConferenceFactory::onRefer(const AmSipRequest& req)
356
+AmSession* ConferenceFactory::onRefer(const AmSipRequest& req, const string& app_name)
357 357
 {
358 358
   if(req.to_tag.empty())
359 359
     throw AmSession::Exception(488,"Not accepted here");
Browse code

Merge branch 'master' into offer_answer

Raphael Coeffic authored on 18/02/2011 11:36:25
Showing 1 changed files
... ...
@@ -783,7 +783,7 @@ void ConferenceDialog::createDialoutParticipant(const string& uri_user)
783 783
   AmSipDialog& dialout_dlg = dialout_session->dlg;
784 784
 
785 785
   dialout_dlg.local_tag    = dialout_id;
786
-  dialout_dlg.callid       = AmSession::getNewId() + "@" + AmConfig::LocalIP;
786
+  dialout_dlg.callid       = AmSession::getNewId();
787 787
 
788 788
   if (from_header.length() > 0) {
789 789
     dialout_dlg.local_party  = from_header;
... ...
@@ -793,16 +793,7 @@ void ConferenceDialog::createDialoutParticipant(const string& uri_user)
793 793
   dialout_dlg.remote_party = uri;
794 794
   dialout_dlg.remote_uri   = uri;
795 795
 
796
-  //string body;
797
-  //int local_port = dialout_session->RTPStream()->getLocalPort();
798
-  //dialout_session->sdp.genRequest(AmConfig::LocalIP,local_port,body);
799
-
800
-  if (extra_headers.length() == 0) {
801
-    extra_headers = "";
802
-  }
803
-
804
-  dialout_dlg.sendRequest("INVITE",
805
-			  "",""/*"application/sdp",body*/,
796
+  dialout_dlg.sendRequest(SIP_METH_INVITE,"","",
806 797
 			  extra_headers);
807 798
 
808 799
   dialout_session->start();
... ...
@@ -885,12 +876,7 @@ void ConferenceDialog::onSipRequest(const AmSipRequest& req)
885 876
   DBG("ConferenceDialog::onSipRequest: remote_party = %s\n",dlg.remote_party.c_str());
886 877
   DBG("ConferenceDialog::onSipRequest: remote_tag = %s\n",dlg.remote_tag.c_str());
887 878
 
888
-  //string body;
889
-  //int local_port = RTPStream()->getLocalPort();
890
-  //sdp.genRequest(AmConfig::LocalIP,local_port,body);
891
-  dlg.sendRequest("INVITE",
892
- 		  "","",//"application/sdp",body,
893
- 		  "");
879
+  dlg.sendRequest(SIP_METH_INVITE);
894 880
 
895 881
   transfer_req.reset(new AmSipRequest(req));
896 882
 
Browse code

Merge branch 'master' into offer_answer

Raphael Coeffic authored on 13/10/2010 14:04:23
Showing 0 changed files
Browse code

ported the first load of plug-ins (those which compile on osx).

Raphael Coeffic authored on 07/10/2010 18:34:03
Showing 1 changed files
... ...
@@ -795,15 +795,17 @@ void ConferenceDialog::createDialoutParticipant(const string& uri_user)
795 795
   dialout_dlg.remote_party = uri;
796 796
   dialout_dlg.remote_uri   = uri;
797 797
 
798
-  string body;
799
-  int local_port = dialout_session->RTPStream()->getLocalPort();
800
-  dialout_session->sdp.genRequest(AmConfig::LocalIP,local_port,body);
798
+  //string body;
799
+  //int local_port = dialout_session->RTPStream()->getLocalPort();
800
+  //dialout_session->sdp.genRequest(AmConfig::LocalIP,local_port,body);
801 801
 
802 802
   if (extra_headers.length() == 0) {
803 803
     extra_headers = "";
804 804
   }
805 805
 
806
-  dialout_dlg.sendRequest("INVITE","application/sdp",body,extra_headers);
806
+  dialout_dlg.sendRequest("INVITE",
807
+			  "",""/*"application/sdp",body*/,
808
+			  extra_headers);
807 809
 
808 810
   dialout_session->start();
809 811
 
... ...
@@ -885,20 +887,22 @@ void ConferenceDialog::onSipRequest(const AmSipRequest& req)
885 887
   DBG("ConferenceDialog::onSipRequest: remote_party = %s\n",dlg.remote_party.c_str());
886 888
   DBG("ConferenceDialog::onSipRequest: remote_tag = %s\n",dlg.remote_tag.c_str());
887 889
 
888
-  string body;
889
-  int local_port = RTPStream()->getLocalPort();
890
-  sdp.genRequest(AmConfig::LocalIP,local_port,body);
891
-  dlg.sendRequest("INVITE","application/sdp",body,"");
890
+  //string body;
891
+  //int local_port = RTPStream()->getLocalPort();
892
+  //sdp.genRequest(AmConfig::LocalIP,local_port,body);
893
+  dlg.sendRequest("INVITE",
894
+ 		  "","",//"application/sdp",body,
895
+ 		  "");
892 896
 
893 897
   transfer_req.reset(new AmSipRequest(req));
894 898
 
895 899
   return;
896 900
 }
897 901
 
898
-void ConferenceDialog::onSipReply(const AmSipReply& reply, int old_dlg_status, const string& trans_method)
902
+void ConferenceDialog::onSipReply(const AmSipReply& reply, AmSipDialog::Status old_dlg_status)
899 903
 {
900
-  int status = dlg.getStatus();
901
-  AmSession::onSipReply(reply, old_dlg_status, trans_method);
904
+  //int status = dlg.getStatus();
905
+  AmSession::onSipReply(reply, old_dlg_status);
902 906
 
903 907
   DBG("ConferenceDialog::onSipReply: code = %i, reason = %s\n, status = %i\n",
904 908
       reply.code,reply.reason.c_str(),dlg.getStatus());
... ...
@@ -907,6 +911,7 @@ void ConferenceDialog::onSipReply(const AmSipReply& reply, int old_dlg_status, c
907 911
      !transfer_req.get())
908 912
     return;
909 913
 
914
+  /*
910 915
   if(status < AmSipDialog::Connected){
911 916
 
912 917
     switch(dlg.getStatus()){
... ...
@@ -992,13 +997,10 @@ void ConferenceDialog::onSipReply(const AmSipReply& reply, int old_dlg_status, c
992 997
       }
993 998
       break;
994 999
 
995
-	    
996
-
997 1000
     default: break;
998 1001
     }
999
-
1000
-
1001 1002
   }
1003
+  */
1002 1004
 }
1003 1005
 
1004 1006
 #ifdef WITH_SAS_TTS
Browse code

added OpenSSL linking exception to license

Stefan Sayer authored on 23/09/2010 14:41:49
Showing 1 changed files
... ...
@@ -1,12 +1,10 @@
1 1
 /*
2
- * $Id$
3
- *
4 2
  * Copyright (C) 2002-2003 Fhg Fokus
5 3
  * Copyright (C) 2007 Juha Heinanen (USE_MYSQL parts)
6 4
  *
7
- * This file is part of sems, a free SIP media server.
5
+ * This file is part of SEMS, a free SIP media server.
8 6
  *
9
- * sems is free software; you can redistribute it and/or modify
7
+ * SEMS is free software; you can redistribute it and/or modify
10 8
  * it under the terms of the GNU General Public License as published by
11 9
  * the Free Software Foundation; either version 2 of the License, or
12 10
  * (at your option) any later version.
... ...
@@ -16,7 +14,7 @@
16 14
  * software, please contact iptel.org by e-mail at the following addresses:
17 15
  *    info@iptel.org
18 16
  *
19
- * sems is distributed in the hope that it will be useful,
17
+ * SEMS is distributed in the hope that it will be useful,
20 18
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 19
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22 20
  * GNU General Public License for more details.
Browse code

SIP Session Timer support for conference app

Stefan Sayer authored on 21/09/2010 22:25:46
Showing 1 changed files
... ...
@@ -73,6 +73,8 @@ PlayoutType ConferenceFactory::m_PlayoutType = ADAPTIVE_PLAYOUT;
73 73
 unsigned int ConferenceFactory::MaxParticipants;
74 74
 
75 75
 bool ConferenceFactory::UseRFC4240Rooms;
76
+AmConfigReader ConferenceFactory::cfg;
77
+AmSessionEventHandlerFactory* ConferenceFactory::session_timer_f = NULL;
76 78
 
77 79
 #ifdef USE_MYSQL
78 80
 mysqlpp::Connection ConferenceFactory::Connection(mysqlpp::use_exceptions);
... ...
@@ -155,7 +157,6 @@ int get_audio_file(const string& message, const string& domain, const string& la
155 157
 
156 158
 int ConferenceFactory::onLoad()
157 159
 {
158
-  AmConfigReader cfg;
159 160
   if(cfg.loadFile(AmConfig::ModConfigPath + string(APP_NAME)+ ".conf"))
160 161
     return -1;
161 162
 
... ...
@@ -297,6 +298,15 @@ int ConferenceFactory::onLoad()
297 298
   UseRFC4240Rooms = cfg.getParameter("use_rfc4240_rooms")=="yes";
298 299
   DBG("%ssing RFC4240 room naming.\n", UseRFC4240Rooms?"U":"Not u");
299 300
 
301
+  if(cfg.hasParameter("enable_session_timer") &&
302
+     (cfg.getParameter("enable_session_timer") == string("yes")) ){
303
+    DBG("enabling session timers\n");
304
+    session_timer_f = AmPlugIn::instance()->getFactory4Seh("session_timer");
305
+    if(session_timer_f == NULL){
306
+      ERROR("Could not load the session_timer module: disabling session timers.\n");
307
+    }
308
+  }
309
+
300 310
   return 0;
301 311
 }
302 312
 
... ...
@@ -322,7 +332,27 @@ AmSession* ConferenceFactory::onInvite(const AmSipRequest& req)
322 332
     conf_id = req.user.substr(5);
323 333
   }
324 334
 
325
-  return new ConferenceDialog(conf_id);
335
+  ConferenceDialog* s = new ConferenceDialog(conf_id);
336
+
337
+  setupSessionTimer(s);
338
+
339
+  return s;
340
+}
341
+
342
+void ConferenceFactory::setupSessionTimer(AmSession* s) {
343
+  if (NULL != session_timer_f) {
344
+
345
+    AmSessionEventHandler* h = session_timer_f->getHandler(s);
346
+    if (NULL == h)
347
+      return;
348
+
349
+    if(h->configure(cfg)){
350
+      ERROR("Could not configure the session timer: disabling session timers.\n");
351
+      delete h;
352
+    } else {
353
+      s->addHandler(h);
354
+    }
355
+  }
326 356
 }
327 357
 
328 358
 AmSession* ConferenceFactory::onRefer(const AmSipRequest& req)
... ...
@@ -332,7 +362,8 @@ AmSession* ConferenceFactory::onRefer(const AmSipRequest& req)
332 362
 
333 363
   AmSession* s = new ConferenceDialog(req.user);
334 364
   s->dlg.local_tag  = req.from_tag;
335
-    
365
+  
366
+  setupSessionTimer(s);
336 367
 
337 368
   DBG("ConferenceFactory::onRefer: local_tag = %s\n",s->dlg.local_tag.c_str());
338 369
 
... ...
@@ -749,6 +780,8 @@ void ConferenceDialog::createDialoutParticipant(const string& uri_user)
749 780
 			 AmConferenceStatus::getChannel(getLocalTag(),
750 781
 							dialout_id));
751 782
 
783
+  ConferenceFactory::setupSessionTimer(dialout_session);
784
+
752 785
   AmSipDialog& dialout_dlg = dialout_session->dlg;
753 786
 
754 787
   dialout_dlg.local_tag    = dialout_id;
Browse code

reworked SST + B2BUA implementation

- B2BUA app with SIP Session Timer (SST) now can also use UPDATE
(see session_refresh_method in sst_b2b.conf)

- if re-INVITE is used, normal SDP OA (INVITE+SDP/200+SDP) is done
using last established SDP (instead of delayed SDP negotiation
and SDP ping-pong)

- SDP is compared only after o= line (no SDP ping-pong with UAs which
always increase SDP version)

Stefan Sayer authored on 21/09/2010 21:49:29
Showing 1 changed files
... ...
@@ -862,10 +862,10 @@ void ConferenceDialog::onSipRequest(const AmSipRequest& req)
862 862
   return;
863 863
 }
864