OsStatus LoginCGI::handleWebRequest( UtlString* out ) { UtlString redirectUrl, dynamicHtml ; MailboxManager* pMailboxManager = MailboxManager::getInstance(); OsStatus result = pMailboxManager->getMediaserverURLForWeb( redirectUrl ) ; if( result == OS_SUCCESS ) { // Validate the mailbox id and extension. ValidateMailboxCGIHelper validateMailboxHelper ( m_userid ); result = validateMailboxHelper.execute( out ); if ( result == OS_SUCCESS ) redirectUrl += CGI_URL + UtlString( "?action=retrieve&fromweb=yes" ) ; else redirectUrl += VOICEMAIL_NOT_ENABLED_URL; dynamicHtml = HTML_BEGIN \ REDIRECT_SCRIPT_BEGIN + redirectUrl + REDIRECT_SCRIPT_END \ HTML_END ; } else { dynamicHtml = HTML_BEGIN \ PROTOCOL_MISMATCH \ HTML_END ; } if (out) { out->remove(0); out->append(dynamicHtml.data()); } return OS_SUCCESS ; }
OsStatus ManageNotificationsWebCGI::execute(UtlString* out) { // Validate the mailbox id and extension. ValidateMailboxCGIHelper validateMailboxHelper ( m_mailboxIdentity ); OsStatus result = validateMailboxHelper.execute( out ); if ( result == OS_SUCCESS ) { // Get the base URL for the Mediaserver MailboxManager* pMailboxManager = MailboxManager::getInstance(); result = pMailboxManager->getMediaserverURLForWeb( m_cgiUrl ) ; if( result == OS_SUCCESS ) { // Construct the base URL for the CGI m_cgiUrl += CGI_URL ; // Get the actual mailbox identity. validateMailboxHelper.getMailboxIdentity( m_mailboxIdentity ); // Call appropriate methods based on the action parameter if( m_action == "managenotifications" ) { result = getManageNotificationsUI(out) ; } else if( m_action == "geteditnotificationui" || m_action == "getaddnotificationui" ) { result = getAddEditNotificationsUI(out); } else if(m_action == "addnotification" || m_action == "editnotification" || m_action == "deletenotification" ) { result = addEditDeleteNotification( out ); } else { result = OS_FAILED ; } } else { UtlString dynamicHtml = HTML_BEGIN \ PROTOCOL_MISMATCH \ HTML_END ; if( out ) { out->remove(0); out->append( dynamicHtml.data() ); } result = OS_SUCCESS ; } } return result ; }
OsStatus RecycleDeletedMsgsCGI::execute(UtlString* out) { // Validate the mailbox id and extension. ValidateMailboxCGIHelper validateMailboxHelper ( m_mailboxIdentity ); OsStatus result = validateMailboxHelper.execute( out ); if( result == OS_SUCCESS ) { validateMailboxHelper.getMailboxIdentity( m_mailboxIdentity ); if( m_fromWeb ) result = handleWebRequest( out ) ; else result = handleOpenVXIRequest( out ) ; } return result; }
OsStatus UpdateMessageStatesCGI::execute(UtlString* out) { // Validate the mailbox id and extension. ValidateMailboxCGIHelper validateMailboxHelper ( m_mailboxIdentity ); OsStatus result = validateMailboxHelper.execute( out ); if( result == OS_SUCCESS ) { validateMailboxHelper.getMailboxIdentity( m_mailboxIdentity ); if( m_fromWeb ) { if( m_linkInEmail ) result = handleEmailRequest( out ); else result = handleWebRequest( out ) ; } else result = handleOpenVXIRequest( out ) ; } return result; }
OsStatus ManageFoldersWebCGI::execute(UtlString* out) { // Validate the mailbox id and extension. ValidateMailboxCGIHelper validateMailboxHelper ( m_mailboxIdentity ); OsStatus result = validateMailboxHelper.execute( out ); if ( result == OS_SUCCESS ) { MailboxManager* pMailboxManager = MailboxManager::getInstance(); result = pMailboxManager->getMediaserverURLForWeb( m_cgiUrl ) ; if( result == OS_SUCCESS ) { m_cgiUrl += CGI_URL ; // unescape the folder names HttpMessage::unescape( m_newFolder ); HttpMessage::unescape( m_oldFolder ); validateMailboxHelper.getMailboxIdentity( m_mailboxIdentity ); if( m_action == "getpersonalfolders" ) { result = getPersonalFolders(out) ; } else if( m_action == "getfolders" ) { result = getAllFolders( out ); } else if(m_action == "addfolder" || m_action == "editfolder" || m_action == "deletefolder" ) { result = addEditDeleteFolder( out ); } else if(m_action == "getaddfolderui" || m_action == "geteditfolderui" ) { result = getAddEditFolderUI( out ); } else { result = OS_FAILED ; } } else { UtlString dynamicHtml = HTML_BEGIN \ PROTOCOL_MISMATCH \ HTML_END ; if( out ) { out->remove(0); out->append( dynamicHtml.data() ); } result = OS_SUCCESS ; } } return result ; }
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; }