Description: Make the code build again
 Due to the build system not failing on compilation/link errors, parts of
 the code base has suffered bit rot.
Author: Guillem Jover <gjover@sipwise.com>

---

--- ngcp-sems-1.6.0.orig/apps/examples/b2b_connect/b2b_connect.cpp
+++ ngcp-sems-1.6.0/apps/examples/b2b_connect/b2b_connect.cpp
@@ -251,10 +251,11 @@ inline UACAuthCred* b2b_connectCalleeSes
   return &credentials;
 }
 
-void b2b_connectCalleeSession::onSipReply(const AmSipReply& reply,
+void b2b_connectCalleeSession::onSipReply(const AmSipRequest& req,
+					  const AmSipReply& reply,
 					  AmSipDialog::Status old_dlg_status) {
 
-  AmB2ABCalleeSession::onSipReply(reply, old_dlg_status);
+  AmB2ABCalleeSession::onSipReply(req, reply, old_dlg_status);
  
   if ((old_dlg_status < AmSipDialog::Connected) &&
       (dlg->getStatus() == AmSipDialog::Disconnected)) {
--- ngcp-sems-1.6.0.orig/apps/examples/b2b_connect/b2b_connect.h
+++ ngcp-sems-1.6.0/apps/examples/b2b_connect/b2b_connect.h
@@ -84,7 +84,7 @@ class b2b_connectCalleeSession
   AmSipRequest invite_req;
 
  protected:
-  void onSipReply(const AmSipReply& reply, AmSipDialog::Status old_dlg_status);
+  void onSipReply(const AmSipRequest& req, const AmSipReply& reply, AmSipDialog::Status old_dlg_status);
  
 public:
   b2b_connectCalleeSession(const string& other_tag, 
--- ngcp-sems-1.6.0.orig/apps/examples/cacheannounce/CacheAnnounce.cpp
+++ ngcp-sems-1.6.0/apps/examples/cacheannounce/CacheAnnounce.cpp
@@ -120,7 +120,7 @@ void CacheAnnounceDialog::process(AmEven
 
     AmAudioEvent* audio_event = dynamic_cast<AmAudioEvent*>(event);
     if(audio_event && (audio_event->event_id == AmAudioEvent::cleared)){
-	dlg.bye();
+	dlg->bye();
 	setStopped();
 	return;
     }
--- ngcp-sems-1.6.0.orig/apps/examples/jukecall/Jukecall.cpp
+++ ngcp-sems-1.6.0/apps/examples/jukecall/Jukecall.cpp
@@ -128,10 +128,10 @@ void JukecallSession::process(AmEvent* e
     switch(state) {
     case JC_initial_announcement: {
       state = JC_connect;
-      string callee = "sip:" + dlg->user.substr(3) + "@" + dlg->domain;
+      string callee = "sip:" + dlg->getUser().substr(3) + "@" + dlg->getDomain();
       DBG("-------------------------- connecting %s ------------------------\n", callee.c_str());
       connectCallee(callee, callee, 
-		    dlg->remote_party, dlg->remote_uri);
+		    dlg->getRemoteParty(), dlg->getRemoteUri());
 
       return;
 
--- ngcp-sems-1.6.0.orig/apps/examples/pinauthconference/PinAuthConference.cpp
+++ ngcp-sems-1.6.0/apps/examples/pinauthconference/PinAuthConference.cpp
@@ -123,7 +123,7 @@ void PinAuthConferenceDialog::connectCon
   changeCallgroup(conf_id);
 
   // get a channel from the status 
-  channel.reset(AmConferenceStatus::getChannel(conf_id,getLocalTag()));
+  channel.reset(AmConferenceStatus::getChannel(conf_id,getLocalTag(),RTPStream()->getSampleRate()));
 
   // clear the playlist
   play_list.flush();
--- ngcp-sems-1.6.0.orig/apps/examples/simple_conference/SimpleConference.cpp
+++ ngcp-sems-1.6.0/apps/examples/simple_conference/SimpleConference.cpp
@@ -66,13 +66,13 @@ SimpleConferenceDialog::SimpleConference
 SimpleConferenceDialog::~SimpleConferenceDialog()
 {
   // clean playlist items
-  play_list.close(false);
+  play_list.flush();
 }
 
 void SimpleConferenceDialog::onSessionStart()
 {
   // set the conference id ('conference room') to user part of ruri
-  conf_id = dlg->user;
+  conf_id = dlg->getUser();
 
   // open the beep file
   BeepSound.reset(new AmAudioFile());
@@ -81,7 +81,7 @@ void SimpleConferenceDialog::onSessionSt
   }
 
   // get a channel from the status 
-  channel.reset(AmConferenceStatus::getChannel(conf_id,getLocalTag()));
+  channel.reset(AmConferenceStatus::getChannel(conf_id,getLocalTag(),RTPStream()->getSampleRate()));
   
   // add the channel to our playlist
   play_list.addToPlaylist(new AmPlaylistItem(channel.get(),
@@ -100,7 +100,7 @@ void SimpleConferenceDialog::onSessionSt
 
 void SimpleConferenceDialog::onBye(const AmSipRequest& req)
 {
-  play_list.close();
+  play_list.flush();
   setInOut(NULL,NULL);
   channel.reset(NULL);
   setStopped();
--- ngcp-sems-1.6.0.orig/apps/examples/urlcatcher/UrlCatcher.cpp
+++ ngcp-sems-1.6.0/apps/examples/urlcatcher/UrlCatcher.cpp
@@ -63,8 +63,14 @@ int UrlCatcherFactory::onLoad()
 AmSession* UrlCatcherFactory::onInvite(const AmSipRequest& req, const string& app_name,
 				       const map<string,string>& app_params)
 {
+  const AmMimeBody* body = req.body.hasContentType(SIP_APPLICATION_SDP);
+  if (!body) {
+    ERROR("Missing MIME body\n");
+    throw AmSession::Exception(404, "Not Found Here (Missing MIME body)");
+  }
+
   AmSdp sdp;
-  if (sdp.parse(req.body.c_str())) {
+  if (sdp.parse((const char *)body->getPayload())) {
     ERROR("SDP parsing error\n");
     throw AmSession::Exception(404, "Not Found Here (SDP parse error)");
   }
