redirect.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00027 #ifndef ASTXX_MANAGER_ACTION_REDIRECT_H
00028 #define ASTXX_MANAGER_ACTION_REDIRECT_H
00029
00030 #include <astxx/manager/basic_action.h>
00031 #include <astxx/manager/message.h>
00032 #include <string>
00033 #include <boost/lexical_cast.hpp>
00034
00035 namespace astxx {
00036 namespace manager {
00037 namespace action {
00038 using boost::lexical_cast;
00039
00041 class redirect : public basic_action {
00042 public:
00049 redirect(const std::string& channel, const std::string& context, const std::string& exten, const std::string& priority)
00050 : channel(channel), context(context), exten(exten), priority(priority) {
00051 }
00052
00059 redirect(const std::string& channel, const std::string& context, unsigned int exten, const std::string& priority)
00060 : channel(channel), context(context), exten(lexical_cast<std::string>(exten)), priority(priority) {
00061 }
00062
00069 redirect(const std::string& channel, const std::string& context, const std::string& exten, unsigned int priority)
00070 : channel(channel), context(context), exten(exten), priority(lexical_cast<std::string>(priority)) {
00071 }
00072
00079 redirect(const std::string& channel, const std::string& context, unsigned int exten, unsigned int priority)
00080 : channel(channel), context(context), exten(lexical_cast<std::string>(exten)), priority(lexical_cast<std::string>(priority)) {
00081 }
00082
00088 redirect& extra_channel(const std::string& extra_channel) {
00089 m_extra_channel = extra_channel;
00090 return *this;
00091 }
00092
00093 message::action action() const {
00094 message::action action("Redirect");
00095 action["Channel"] = channel;
00096
00097 if (not m_extra_channel.empty()) {
00098 action["ExtraChannel"] = m_extra_channel;
00099 }
00100
00101 action["Context"] = context;
00102 action["Exten"] = exten;
00103 action["Priority"] = priority;
00104
00105 return action;
00106 }
00107
00108 private:
00109 std::string channel;
00110 std::string m_extra_channel;
00111 std::string context;
00112 std::string exten;
00113 std::string priority;
00114 };
00115 }
00116 }
00117 }
00118
00119 #endif