bool RecorderSession::OnChannelAdd(mrcp_channel_t* pMrcpChannel, mrcp_sig_status_code_e status)
{
	if(!UmcSession::OnChannelAdd(pMrcpChannel,status))
		return false;

	if(status != MRCP_SIG_STATUS_CODE_SUCCESS)
	{
		/* error case, just terminate the demo */
		return Terminate();
	}

	return StartRecorder(pMrcpChannel);
}
MRESULT EXPENTRY OSARecordEventsDlgProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
   Environment    *ev;
   PRECORDER_PARM     prec;
   HWND            hwndButton;
   CHAR            szTemp[CCHMAXPATH];
   PSZ             pszBuffer,pszTemp;
   SWP             swp;
   PSWP            pswpNew, pswpOld;
   MRESULT         result;
   OSAError        retVal = noErr;

   switch(msg)
   {
      case WM_INITDLG:
         prec = (PRECORDER_PARM) calloc(1,sizeof(RECORDER_PARM));
         prec->pmp =  (PMAIN_PARM) mp2;
         prec->hwnd = hwnd;
         prec->pmp->hwndRecordEvent = hwnd;
         InitRecorder(prec);
         break;

      case WM_ADD_RECORDEDEVENT:
         prec = (PRECORDER_PARM) WinQueryWindowULong( hwnd, QWL_USER );
         AddRecordedEvents(prec, (OSAEvent *) mp1);
         break;

      case WM_WINDOWPOSCHANGED:
         pswpNew = (PSWP) mp1;
         pswpOld = pswpNew + 1;
         hwndButton = WinWindowFromID(hwnd, IDD_ODRECSTATUS);
         WinQueryWindowPos(hwndButton, &swp);
         WinSetWindowPos(hwndButton,
                         HWND_TOP,
                         swp.x,
                         swp.y+(pswpNew->cy - pswpOld->cy),
                         0,
                         0,
                         SWP_MOVE );
         hwndButton = WinWindowFromID(hwnd, IDD_ODDISPLAYEVENTS);
         WinQueryWindowPos(hwndButton, &swp);
         WinSetWindowPos(hwndButton,
                         HWND_TOP,
                         0,
                         0,
                         swp.cx+(pswpNew->cx - pswpOld->cx),
                         swp.cy+(pswpNew->cy - pswpOld->cy),
                         SWP_SIZE );
         result = WinDefDlgProc(hwnd, msg, mp1, mp2);
         WinInvalidateRect(hwnd, NULL, TRUE);
         return result;
         break;

      case WM_PAINT: {
         SWP Pos, DlgPos;
         HPS Hps;
         RECTL Rect;

         /* First let dialog do normal painting */
         WinDefDlgProc(hwnd, msg, mp1, mp2);

         /* Paint recessed frame around the status line */
         Hps = WinGetPS(hwnd);
         WinQueryWindowPos(WinWindowFromID(hwnd, IDD_ODRECSTATUS), &Pos);
         WinQueryWindowPos(hwnd, &DlgPos);
         Rect.xLeft = WinQuerySysValue(HWND_DESKTOP, SV_CXDLGFRAME);
         Rect.xRight= DlgPos.cx - Rect.xLeft;
         Rect.yBottom = Pos.y - 1;
         Rect.yTop    = Pos.y + Pos.cy + 1;
         #define DB_RAISED    0x0400  // Undocumented borders
         #define DB_DEPRESSED 0x0800
         WinDrawBorder(Hps, &Rect, 1, 1, 0, 0, DB_DEPRESSED);
         WinReleasePS(Hps);
         return 0;
         }

      case WM_COMMAND:
         switch (SHORT1FROMMP (mp1)){
            case IDD_ODRECSTART:
               prec = (PRECORDER_PARM) WinQueryWindowULong( hwnd, QWL_USER );
               StartRecorder(prec);
               WinSetWindowText(prec->hwndStatus, "recording...");
               break;
            case IDD_ODRECSTOP:
               prec = (PRECORDER_PARM) WinQueryWindowULong( hwnd, QWL_USER );
               StopRecorder(prec);
               strcpy(szTemp,prec->szTitle);
               WinSetWindowText(prec->hwndStatus, "idl...");
               break;
            case IDD_ODRECCANCEL:
               prec = (PRECORDER_PARM) WinQueryWindowULong( hwnd, QWL_USER );
               if(prec->recording)
                 StopRecorder(prec);
               // Save window size/pos info
               WinQueryWindowPos(hwnd, &swp);
               prec->pmp->Profile.testrec_cx = swp.cx;
               prec->pmp->Profile.testrec_cy = swp.cy;
               prec->pmp->Profile.testrec_x = swp.x;
               prec->pmp->Profile.testrec_y = swp.y;
               WinQueryWindowPos(prec->hwndStatus, &swp);
               prec->pmp->Profile.testrecStat_cx = swp.cx;
               prec->pmp->Profile.testrecStat_cy = swp.cy;
               prec->pmp->Profile.testrecStat_x = swp.x;
               prec->pmp->Profile.testrecStat_y = swp.y;
               prec->pmp->hwndRecordEvent = NULL;
               free((PVOID)prec);
               WinDismissDlg(hwnd, TRUE);
               break;
            default:
               ;
         } /* endswitch */
         break;

      case WM_CLOSE:
         WinPostMsg(hwnd, WM_COMMAND, MPFROMSHORT(IDD_ODRECCANCEL), NULL);
         break;
      default:
         return(WinDefDlgProc(hwnd, msg, mp1, mp2));
   }
   return (MRESULT)NULL;
}   /*  end of OSAScriptEditorDlgProc()  */