⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 osbclient.c

📁 Open VXI. This is a open source.
💻 C
📖 第 1 页 / 共 3 页
字号:
  /* Now shutdown Object */  objResult = OSBobjectShutDown(gblLog);  CLIENT_CHECK_RESULT("OSBobjectShutDown()", objResult);    /* Now shutdown ECMAScript */  jsiResult = OSBjsiShutDown(gblLog);  CLIENT_CHECK_RESULT("OSBjsiShutDown()", jsiResult);    /* Now shut down the recognizer */  recResult = OSBrecShutDown(gblLog);  CLIENT_CHECK_RESULT("OSBrecShutDown()", recResult);  /* Shutdown the prompting engine. */  promptResult = OSBpromptShutDown(gblLog);  CLIENT_CHECK_RESULT("OSBpromptShutDown()", promptResult);    /* Shutdown the internet fetching component */  inetResult = OSBinetShutDown(gblLog);  CLIENT_CHECK_RESULT("OSBinetShutDown()", inetResult);  /* Shutdown the tel component */  telResult = OSBtelShutDown(gblLog);  CLIENT_CHECK_RESULT("OSBtelShutDown()", telResult);  /* Destroy the global logging API.  The system is going     out of service. Should be one of the last functions run. */  SBclientDiag(NULL, CLIENT_API_TAG, L"VXIplatformShutdown", 	       L"exiting: rc = %d (prior to log shutdown)",	       VXIplatform_RESULT_SUCCESS);  logResult = OSBlogDestroyResource(&gblLog);  CLIENT_CHECK_RESULT("OSBlogDestroyResource()", logResult);  /* Shutdown the logging API. At this point system should just     be returning and no OSB PIK component functions should be run */  logResult = OSBlogShutDown();  CLIENT_CHECK_RESULT("OSBlogShutDown()", logResult);  return VXIplatform_RESULT_SUCCESS;}/** * Create resources for the platform. * * This function creates all the resources needed by the VXI to * execute.  This includes both APIs that the VXI calls directly and * the APIS that those components call.  All components in the OSB PIK are * exposed here.<p> * * The resources will be written into the platform pointer which is * allocated in this function.   */VXIPLATFORM_API VXIplatformResultVXIplatformCreateResources(VXIunsigned channelNum,                           VXIMap *configArgs,                            VXIplatform **platform){  VXIplatform *newPlatform;  VXItelResult telResult;  VXIlogResult logResult;  VXIinetResult inetResult;  VXIpromptResult promptResult;  VXIjsiResult jsiResult;  VXIobjResult objResult;  VXIrecResult recResult;  VXIinterpreterResult interpreterResult;    if (!gblPlatformInitialized) {    return VXIplatform_RESULT_NOT_INITIALIZED;  }  if (platform == NULL) {    return VXIplatform_RESULT_INVALID_ARGUMENT;  }  SBclientDiag(NULL, CLIENT_API_TAG, L"VXIplatformCreateResources",	       L"entering: %u, 0x%p, 0x%p", channelNum, configArgs, platform);  /* set platform to NULL and then initialize it to all NULL     components once it is created */  *platform = NULL;    newPlatform = (VXIplatform *) malloc(sizeof(VXIplatform));  CLIENT_CHECK_MEMALLOC(newPlatform, "VXIplatform");  memset(newPlatform, 0, sizeof(VXIplatform));    newPlatform->channelNum = channelNum;          /* Create a channel logging resource.  A logging interface, per     channel, is required to do the logging.  The channel number is     bound at the creation time and will appear in any log message     generated through this interface instance. */  logResult = OSBlogCreateResource(channelNum, &newPlatform->VXIlog);  CLIENT_CHECK_RESULT("OSBlogCreateResource()", logResult);  /* Turn on/off diagnostic tags based on the configuration settings,     we have to log the implementation name after this otherwise     we'll never see the message */  SBclientConfigureDiagnosticTags (configArgs, newPlatform);  CLIENT_LOG_IMPLEMENTATION(L"VXIlog", newPlatform->VXIlog);    /* Create the VXItel implementation resource.  This is required by     the VXI for handling telephony functions. The telephony resource     uses the session control resource to perform its functions so it     must be passed in. */  telResult = OSBtelCreateResource(newPlatform->VXIlog, &newPlatform->VXItel);  CLIENT_CHECK_RESULT("OSBtelCreateResource()", telResult);  CLIENT_LOG_IMPLEMENTATION(L"VXItel", newPlatform->VXItel);    /* Lookup whether cookies should be accepted */  SBclientGetParamBool(configArgs, CLIENT_INET_ACCEPT_COOKIES, 		       &newPlatform->acceptCookies, TRUE);    /* Create the internet component for fetching URLs */  inetResult = OSBinetCreateResource(newPlatform->VXIlog, 				     &newPlatform->VXIinet);  CLIENT_CHECK_RESULT("OSBinetCreateResource()", inetResult);  CLIENT_LOG_IMPLEMENTATION(L"VXIinet", newPlatform->VXIinet);  /* Now create the prompt resource. The prompting resource takes a     logging interface for logging and the inet interface for getting     URIs */  promptResult = OSBpromptCreateResource(newPlatform->VXIlog, 					 newPlatform->VXIinet,					 &newPlatform->VXIprompt);  CLIENT_CHECK_RESULT("OSBpromptCreateResource()", promptResult);  CLIENT_LOG_IMPLEMENTATION(L"VXIprompt", newPlatform->VXIprompt);    /* Now create the recognizer resource */  recResult = OSBrecCreateResource(newPlatform->VXIlog, &newPlatform->VXIrec);  CLIENT_CHECK_RESULT("OSBrecCreateResource()", recResult);  CLIENT_LOG_IMPLEMENTATION(L"VXIrec", newPlatform->VXIrec);    /* Now create the jsi resource.  This is used for storing and     computing ECMAScript results by the VXI. Internal component     required by VXI */  jsiResult = OSBjsiCreateResource(newPlatform->VXIlog, &newPlatform->VXIjsi);  CLIENT_CHECK_RESULT("OSBjsiCreateResource()", jsiResult);  CLIENT_LOG_IMPLEMENTATION(L"VXIjsi", newPlatform->VXIjsi);  /* Now create the object resource.  This is used for executing     VoiceXML <object> elements */  newPlatform->objectResources.log     = newPlatform->VXIlog;  newPlatform->objectResources.inet    = newPlatform->VXIinet;  newPlatform->objectResources.jsi     = newPlatform->VXIjsi;  newPlatform->objectResources.rec     = newPlatform->VXIrec;  newPlatform->objectResources.prompt  = newPlatform->VXIprompt;  newPlatform->objectResources.tel     = newPlatform->VXItel;  objResult = OSBobjectCreateResource(&newPlatform->objectResources,				     &newPlatform->VXIobject);  CLIENT_CHECK_RESULT("OSBobjectCreateResource()", objResult);  CLIENT_LOG_IMPLEMENTATION(L"VXIobject", newPlatform->VXIobject);  /* Now copy the components required by the VXI into its resource     structure for the VXI initialization */  newPlatform->resources.log     = newPlatform->VXIlog;  newPlatform->resources.inet    = newPlatform->VXIinet;  newPlatform->resources.jsi     = newPlatform->VXIjsi;  newPlatform->resources.rec     = newPlatform->VXIrec;  newPlatform->resources.prompt  = newPlatform->VXIprompt;  newPlatform->resources.tel     = newPlatform->VXItel;  newPlatform->resources.object  = newPlatform->VXIobject;  interpreterResult =     VXIinterpreterCreateResource(&newPlatform->resources,                                 &newPlatform->VXIinterpreter);  CLIENT_CHECK_RESULT("VXIinterpreterCreateResource()", interpreterResult);  CLIENT_LOG_IMPLEMENTATION(L"VXIinterpreter", newPlatform->VXIinterpreter);  /* Set interpreter properties. */  {    const VXIchar *vxiBeepURI = NULL;    const VXIchar *vxiDefaultsURI = NULL;    VXIMap *vxiProperties = VXIMapCreate();    CLIENT_CHECK_MEMALLOC(vxiProperties, "VXI properties");    SBclientGetParamStr(configArgs, CLIENT_VXI_BEEP_URI, &vxiBeepURI, FALSE);    if (vxiBeepURI != NULL) {      VXIString * val = VXIStringCreate(vxiBeepURI);      CLIENT_CHECK_MEMALLOC(val, "VXI properties beep URI");      VXIMapSetProperty(vxiProperties, VXI_BEEP_AUDIO, (VXIValue *) val);    }    SBclientGetParamStr(configArgs, CLIENT_VXI_DEFAULTS_URI, &vxiDefaultsURI,			FALSE);    if (vxiDefaultsURI != NULL) {      VXIString * val = VXIStringCreate(vxiDefaultsURI);      CLIENT_CHECK_MEMALLOC(val, "VXI properties beep URI");      VXIMapSetProperty(vxiProperties, VXI_PLATFORM_DEFAULTS, (VXIValue*) val);    }    if (VXIMapNumProperties(vxiProperties) != 0)      newPlatform->VXIinterpreter->SetProperties(newPlatform->VXIinterpreter,						 vxiProperties);    VXIMapDestroy(&vxiProperties);  }  SBclientDiag(newPlatform, CLIENT_API_TAG, L"VXIplatformCreateResources",	       L"exiting: rc = %d, 0x%p",	       VXIplatform_RESULT_SUCCESS, newPlatform);  /* Return the platform resources that have been created */  *platform = newPlatform;  return VXIplatform_RESULT_SUCCESS;}/** * Destroy resources for the platform. * * This function destroys all the resources needed by the VXI to * execute.  This includes both APIs that the VXI calls directly and * the APIS that those components call.  All components in the OSB PIK are * exposed here.<p> * * The resources will be freed from the platform pointer which is * deleted and set to NULL in this function.   */VXIPLATFORM_API VXIplatformResultVXIplatformDestroyResources(VXIplatform **platform){  VXItelResult telResult;  VXIlogResult logResult;  VXIpromptResult promptResult;  VXIjsiResult jsiResult;  VXIrecResult recResult;  VXIinetResult inetResult;  VXIobjResult objResult;  VXIplatform *pPlatform = NULL;  if ((platform == NULL) || (*platform == NULL)) {    return VXIplatform_RESULT_INVALID_ARGUMENT;  }  if (!gblPlatformInitialized) {    return VXIplatform_RESULT_NOT_INITIALIZED;  }  pPlatform = *platform;  SBclientDiag(pPlatform, CLIENT_API_TAG, L"VXIplatformDestroyResources",	       L"entering: 0x%p", platform);    /* Destroy the VoiceXML interpreter */  VXIinterpreterDestroyResource(&pPlatform->VXIinterpreter);  /* Destroy the object handler */  objResult = OSBobjectDestroyResource(&pPlatform->VXIobject);  CLIENT_CHECK_RESULT("OSBobjectDestroyResource()", objResult);  /* Destroy the ECMAScript interpreter */  jsiResult = OSBjsiDestroyResource(&pPlatform->VXIjsi);  CLIENT_CHECK_RESULT("OSBjsiDestroyResource()", jsiResult);  /* Destroy the recognizer */  recResult = OSBrecDestroyResource(&pPlatform->VXIrec);  CLIENT_CHECK_RESULT("OSBrecDestroyResource()", recResult);  /* Destroy the prompt engine */  promptResult = OSBpromptDestroyResource(&pPlatform->VXIprompt);  CLIENT_CHECK_RESULT("OSBpromptDestroyResource()", promptResult);    /* Destroy the internet component */  inetResult = OSBinetDestroyResource(&pPlatform->VXIinet);  CLIENT_CHECK_RESULT("OSBinetDestroyResource()", inetResult);    /* Destroy the telephony component */  telResult = OSBtelDestroyResource(&pPlatform->VXItel);  CLIENT_CHECK_RESULT("OSBtelDestroyResource()", telResult);    /* Destroy the log component */  logResult = OSBlogDestroyResource(&pPlatform->VXIlog);  CLIENT_CHECK_RESULT("OSBlogDestroyResource()", logResult);      /* Release the platform resource handle */  free(*platform);  *platform = NULL;  SBclientDiag(NULL, CLIENT_API_TAG, L"VXIplatformDestroyResources",	       L"exiting: rc = %d", VXIplatform_RESULT_SUCCESS);  return VXIplatform_RESULT_SUCCESS;}/** * Enables the hardware to wait for a call * * This function enables the hardware to wait for a call using the * resources specified by the passed platform pointer. It blocks until * the hardware is enabled and then returns * VXIplatform_RESULT_SUCCESS.  This must be calld before * VXIplatformWaitForCall. */VXIPLATFORM_API VXIplatformResultVXIplatformEnableCall(VXIplatform *platform){  VXItelResult telResult;  OSBtelInterface *osbTel;  SBclientDiag(platform, CLIENT_API_TAG, L"VXIplatformEnableCall",	       L"entering: 0x%p", platform);  if (!gblPlatformInitialized)    return VXIplatform_RESULT_NOT_INITIALIZED;  if (platform == NULL)    return VXIplatform_RESULT_INVALID_ARGUMENT;  SBclientDiag(platform, CLIENT_GEN_TAG, L"Entering EnableCall", NULL);  /* Enable calls using the telephony interface */  if (wcsstr(platform->VXItel->GetImplementationName( ), L".OSBtel")) {    osbTel = (OSBtelInterface *) platform->VXItel;    telResult = osbTel->EnableCall(osbTel);  } else {    telResult = VXItel_RESULT_UNSUPPORTED;  }  if (telResult != VXItel_RESULT_SUCCESS){    SBclientError(platform, MODULE_OSBCLIENT, 100, L"%s%s%s%d",		  L"MSG", L"OSBtel EnableCall failed", L"rc", telResult);    return (telResult > 0 ? VXIplatform_RESULT_FAILURE : 	    VXIplatform_RESULT_TEL_ERROR);  }  SBclientDiag(platform, CLIENT_API_TAG, L"VXIplatformEnableCall",	       L"exiting: rc = %d", VXIplatform_RESULT_SUCCESS);  SBclientDiag(platform, CLIENT_GEN_TAG, L"Leaving EnableCall", NULL);  return VXIplatform_RESULT_SUCCESS;}/** * Wait for a call. * * This function waits for a call and then answers it using the * resources specified by the passed platform pointer. It blocks until * a call is recieved and then returns VXIplatform_RESULT_SUCCESS. */VXIPLATFORM_API VXIplatformResultVXIplatformWaitForCall(VXIplatform *platform){  VXItelResult telResult;  OSBtelInterface *osbTel;  SBclientDiag(platform, CLIENT_API_TAG, L"VXIplatformWaitForCall",	       L"entering: 0x%p", platform);  if (platform == NULL)    return VXIplatform_RESULT_INVALID_ARGUMENT;  /* Clean up from prior calls if necessary */  if (platform->telephonyProps) {    VXIMapDestroy(&platform->telephonyProps);    platform->telephonyProps = NULL;  }  /* Wait for calls using the telephony interface */  if (wcsstr(platform->VXItel->GetImplementationName( ), L".OSBtel")) {    osbTel = (OSBtelInterface *) platform->VXItel;    telResult = osbTel->WaitForCall(osbTel, &platform->telephonyProps);  } else {    telResult = VXItel_RESULT_UNSUPPORTED;  }  if (telResult != VXItel_RESULT_SUCCESS){    SBclientError(platform, MODULE_OSBCLIENT, 100, L"%s%s%s%d",

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -