OsStatus UpdateMessageStatesCGI::handleOpenVXIRequest( UtlString* out ) { // Instantiate the mailbox manager MailboxManager* pMailboxManager = MailboxManager::getInstance(); OsStatus result = pMailboxManager->updateMessageStates(m_mailboxIdentity, m_category, m_messageIds); UtlString dynamicVxml = getVXMLHeader(); if( result == OS_SUCCESS ) { dynamicVxml += VXML_SUCCESS_SNIPPET; } else { dynamicVxml += VXML_FAILURE_SNIPPET; } dynamicVxml += VXML_END; // Write out the dynamic VXML script to be processed by OpenVXI if (out) { out->remove(0); UtlString responseHeaders; MailboxManager::getResponseHeaders(dynamicVxml.length(), responseHeaders); out->append(responseHeaders.data()); out->append(dynamicVxml.data()); } return OS_SUCCESS; }
OsStatus SaveSystemPromptsCGI::execute(UtlString* out) { OsStatus result = OS_SUCCESS; MailboxManager* pMailboxManager = MailboxManager::getInstance(); // Forward call to Mailbox Manager result = pMailboxManager->saveSystemPrompts( m_promptType, m_data, m_datasize ); UtlString dynamicVxml = getVXMLHeader(); if( result == OS_SUCCESS ) { dynamicVxml += VXML_SUCCESS_SNIPPET; } else { dynamicVxml += VXML_FAILURE_SNIPPET; } dynamicVxml += VXML_END; // Write out the dynamic VXML script to be processed by OpenVXI if (out) { out->remove(0); UtlString responseHeaders; MailboxManager::getResponseHeaders(dynamicVxml.length(), responseHeaders); out->append(responseHeaders.data()); out->append(dynamicVxml.data()); } return OS_SUCCESS; }
OsStatus LoginCGI::handleOpenVXIRequest( UtlString* out ) { OsStatus result = OS_FAILED; // Instantiate the mailbox manager MailboxManager* pMailboxManager = MailboxManager::getInstance(); UtlString dynamicVxml = getVXMLHeader(); // Update the m_mailbox if valid result = pMailboxManager->doLogin( m_userid, // this is an extension m_password, // this is actually a PIN m_mailboxIdentity, // filld in on return m_extension ); // filled in on return if ( result == OS_SUCCESS ) { // Stores the number of unheard messages in inbox. UtlString rUnheardCount; // Stores the total number of mesages in inbox UtlString rTotalCount; // Stores the total number of messages in saved folder. UtlString rSavedCount; // Stores the total number of unheard messages in saved folder. // Note: This is not used. UtlString rSavedUnheardCount; // Call the method on Mailbox Manager to get the mailbox status result = pMailboxManager->getMailboxStatus( m_mailboxIdentity, "inbox", rUnheardCount, rTotalCount ); result = pMailboxManager->getMailboxStatus( m_mailboxIdentity, "saved", rSavedUnheardCount, rSavedCount ); // Check if this user has permission to record system prompts. Url mailboxUrl ( m_mailboxIdentity ); UtlBoolean bHasRecordSystemPromptsPermission = PermissionDB::getInstance()-> hasPermission( mailboxUrl, RECORD_SYSTEM_PROMPTS_PERMISSION ); UtlString strRecordEnabled = "no" ; if( bHasRecordSystemPromptsPermission ) strRecordEnabled = "yes" ; // Check if this user has permission to access voicemail options UtlBoolean bHasVoicemailPermission = PermissionDB::getInstance()-> hasPermission( mailboxUrl, VOICEMAIL_PERMISSION ); UtlString strVoicemailEnabled = "no" ; if( bHasVoicemailPermission ) { strVoicemailEnabled = "yes" ; } dynamicVxml += "<form>\n<block>\n"; dynamicVxml += "<var name=\"result\" expr=\"'success'\"/>\n"; // Construct the VXML scriptlet. if( result == OS_SUCCESS ) { dynamicVxml += "<var name=\"unheard\" expr=\"" + rUnheardCount + "\"/>\n"\ "<var name=\"total\" expr=\"" + rTotalCount + "\"/>\n"\ "<var name=\"saved\" expr=\"" + rSavedCount + "\"/>\n"\ "<var name=\"mailboxid\" expr=\"'" + m_mailboxIdentity + "'\"/>\n" \ "<var name=\"extension\" expr=\"'" + m_extension + "'\"/>\n" \ "<var name=\"isRecordSystemPromptsEnabled\" expr=\"'" + strRecordEnabled + "'\"/>\n" \ "<var name=\"isVoicemailEnabled\" expr=\"'" + strVoicemailEnabled + "'\"/>\n" ; } else { dynamicVxml += "<var name=\"unheard\" expr=\"0\"/>"\ "<var name=\"total\" expr=\"0\"/>"\ "<var name=\"saved\" expr=\"0\"/>"\ "<var name=\"mailboxid\" expr=\"'" + m_mailboxIdentity + "'\"/>\n" \ "<var name=\"extension\" expr=\"'" + m_extension + "'\"/>\n" \ "<var name=\"isRecordSystemPromptsEnabled\" expr=\"'" + strRecordEnabled + "'\"/>\n" \ "<var name=\"isVoicemailEnabled\" expr=\"'" + strVoicemailEnabled + "'\"/>\n" ; } dynamicVxml += "<return namelist=\"result unheard total saved mailboxid extension isRecordSystemPromptsEnabled isVoicemailEnabled\"/>\n"\ "</block>\n</form>\n"; } else { dynamicVxml += VXML_FAILURE_SNIPPET; } dynamicVxml += VXML_END; // Write out the dynamic VXML script to be processed by OpenVXI if (out) { out->remove(0); UtlString responseHeaders; MailboxManager::getResponseHeaders(dynamicVxml.length(), responseHeaders); out->append(responseHeaders.data()); out->append(dynamicVxml.data()); } return OS_SUCCESS ; }
OsStatus DepositCGI::execute(UtlString* out) { // Contains the dynamically generated VXML script. UtlString dynamicVxml = getVXMLHeader() + "<form> "; // Get the base URL of the mediaserver - "http://*****:*****@' ) != UTL_NOT_FOUND ) { useridOrExtension = useridOrExtension(0, useridOrExtension.first( '@' )); } } useridOrExtension.toLower(); dynamicVxml += "<var name=\"msgurl\" expr=\"'" + useridOrExtension + "'\" />\n" \ "<var name=\"msgurltype\" expr=\"'alphanumeric'\"/>\n"; } // If mailboxpath/savemessage.vxml exists, use it, otherwise use the // generic version UtlString src ; UtlString vxmlScript ; pMailboxManager->getMailboxPath(m_mailboxIdentity, vxmlScript); vxmlScript += OsPath::separator + "savemessage.vxml" ; if (OsFileSystem::exists(vxmlScript)) { // use the user specific one pMailboxManager->getMailboxURL(m_mailboxIdentity, src, false); src += "/savemessage.vxml" ; OsSysLog::add(FAC_MEDIASERVER_CGI, PRI_DEBUG, "DepositCGI::execute: using user specific vxml script %s", src.data()) ; } else { // use the generic one src = mediaserverUrl + "/vm_vxml/savemessage.vxml" ; OsSysLog::add(FAC_MEDIASERVER_CGI, PRI_DEBUG, "DepositCGI::execute: using generic vxml script %s", src.data()) ; } // Be careful here as the the vxmlFriendlyFrom will be sent back to us again UtlString vxmlFriendlyFrom = m_from.toString(); MailboxManager::convertUrlStringToXML( vxmlFriendlyFrom ); // HttpMessage::escape( vxmlFriendlyFrom ); dynamicVxml += "<subdialog name=\"send_msg\" src=\"" + src + "\">\n" + "<param name=\"called_by\" value=\"incoming\"/>\n" \ "<param name=\"mailbox\" value=\"" + m_mailboxIdentity + "\"/>\n" \ "<param name=\"from\" value=\"" + vxmlFriendlyFrom + "\"/>\n" \ "<param name=\"msgurl\" expr=\"msgurl\" />\n" \ "<param name=\"msgurltype\" expr=\"msgurltype\" />\n" \ "<param name=\"mediaserverurl\" expr=\"'" + ivrPromptUrl + "'\"/>\n" \ "<param name=\"securemediaserverurl\" expr=\"'" + secureMediaserverUrl + "'\"/>\n" \ "</subdialog>"; } else { dynamicVxml += "<subdialog src=\"" + mediaserverUrl + "/vm_vxml/error_handler.vxml\" >\n" \ "<param name=\"errortype\" expr=\"'invalidextn'\" />\n" \ "<param name=\"mediaserverurl\" expr=\"'" + ivrPromptUrl + "'\" />\n" \ "<param name=\"securemediaserverurl\" expr=\"'" + secureMediaserverUrl + "'\"/>\n" \ "</subdialog>\n"; } dynamicVxml += "</form>" + UtlString( VXML_END ); // Write out the dynamic VXML script to be processed by OpenVXI if (out) { out->remove(0); UtlString responseHeaders; MailboxManager::getResponseHeaders(dynamicVxml.length(), responseHeaders); out->append(responseHeaders.data()); out->append(dynamicVxml.data()); } return OS_SUCCESS; }