< Previous by Date Date Index Next by Date >
  Thread Index  

[reSIProcate-users] What is the correct way to end all calls when shutting down the application?


Hi all,

I derived my application code from basicCall example. My application
is actually a UAS that can accept multiple calls. When shutting down
the application I should end all the calls.

My approach is:

1. In InviteSessionHandler derived class I added a dialog set map member:
  typedef map<DialogSetId, AppDialogSetHandle> DialogSetMap;
  DialogSetMap mDialogSetMap;

2. In onNewSession callback I save the handle in the map:
    AppDialogSetHandle dsh = sis->getAppDialogSet();
    mDialogSetMap[dsh->getDialogSetId()] = dsh;

3. In onTerminated callback I remove the handle from the map:
    AppDialogSetHandle dsh = is->getAppDialogSet();
    mDialogSetMap.erase(dsh->getDialogSetId());

4. In Hangup method I end all the calls:
    for (DialogSetMap::iterator it = mDialogSetMap.begin(); it !=
mDialogSetMap.end(); it++)
    {
      AppDialogSetHandle dsh = it->second;
      dsh->end();
    }
    mDialogSetMap.clear();

My question is if this is the correct way to end all the calls when
shutting down the application? Is there any other more correct
approach?


Thanks in advance