mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-12 22:34:18 +00:00
- fxo-busy-disconnection timer for desconnection on FXO
- khomp set changes configuration - KR2GotCategory variable - Disconnection forced R2 signaling (collect call) - restricted, omits the number of origin - Option to enable/disable dial with '#' on FXS - Added KR2StrCategory - Added "khomp dump config" command - KISDNOrigTypeOfNumber, KISDNDestTypeOfNumber, KISDNOrigNumberingPlan, KISDNDestNumberingPlan, KISDNOrigPresentation - New version of commons - Updated documentation
This commit is contained in:
1 parent
d46ea5d346
commit
2f9357b2a7
33 files changed
+654
-272
No files matched your search
@@ -733,17 +733,21 @@ struct Cli
|
||||
options.push_back("fxs-global-orig");
|
||||
options.push_back("fxs-co-dialtone");
|
||||
options.push_back("fxs-bina");
|
||||
options.push_back("fxs-sharp-dial");
|
||||
options.push_back("disconnect-delay");
|
||||
options.push_back("delay-ringback-co");
|
||||
options.push_back("delay-ringback-pbx");
|
||||
options.push_back("ignore-letter-dtmfs");
|
||||
options.push_back("fxo-send-pre-audio");
|
||||
options.push_back("fxo-busy-disconnection");
|
||||
options.push_back("fxs-digit-timeout");
|
||||
options.push_back("drop-collect-call");
|
||||
options.push_back("kommuter-activation");
|
||||
options.push_back("kommuter-timeout");
|
||||
options.push_back("user-transfer-digits");
|
||||
options.push_back("flash-to-digits");
|
||||
options.push_back("accountcode");
|
||||
options.push_back("audio-packet-length");
|
||||
|
||||
brief = "Get configuration options in the Khomp channel.";
|
||||
|
||||
@@ -821,17 +825,21 @@ struct Cli
|
||||
options.push_back("fxs-global-orig");
|
||||
options.push_back("fxs-co-dialtone");
|
||||
options.push_back("fxs-bina");
|
||||
options.push_back("fxs-sharp-dial");
|
||||
options.push_back("disconnect-delay");
|
||||
options.push_back("delay-ringback-co");
|
||||
options.push_back("delay-ringback-pbx");
|
||||
options.push_back("ignore-letter-dtmfs");
|
||||
options.push_back("fxo-send-pre-audio");
|
||||
options.push_back("fxo-busy-disconnection");
|
||||
options.push_back("fxs-digit-timeout");
|
||||
options.push_back("drop-collect-call");
|
||||
options.push_back("kommuter-activation");
|
||||
options.push_back("kommuter-timeout");
|
||||
options.push_back("user-transfer-digits");
|
||||
options.push_back("flash-to-digits");
|
||||
options.push_back("accountcode");
|
||||
options.push_back("audio-packet-length");
|
||||
|
||||
brief = "Ajust configuration options in the Khomp channel.";
|
||||
|
||||
@@ -933,6 +941,36 @@ struct Cli
|
||||
bool execute(int argc, char *argv[]);
|
||||
} KhompRevision;
|
||||
|
||||
/* khomp dump config */
|
||||
static struct _KhompDumpConfig : public Command
|
||||
{
|
||||
_KhompDumpConfig()
|
||||
{
|
||||
complete_name = "dump config";
|
||||
brief = "Dump configuration values on screen.";
|
||||
|
||||
usage = \
|
||||
"\nUsage: khomp dump config\n\n" \
|
||||
"Dump configuration values loaded on memory.\n ";
|
||||
|
||||
_commands.push_back(this);
|
||||
}
|
||||
|
||||
/* just to hide unavaible options */
|
||||
bool removeUnavaible(const std::string &s)
|
||||
{
|
||||
if(s == "atxfer" || s == "blindxfer" || s == "callgroup" ||
|
||||
s == "mohclass" || s == "native-bridge" || s == "recording" ||
|
||||
s == "record-prefix" || s == "transferdigittimeout" ||
|
||||
s == "pickupgroup" || s == "has-ctbus" ||
|
||||
s == "user-transfer-digits")
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool execute(int argc, char *argv[]);
|
||||
} KhompDumpConfig;
|
||||
|
||||
/* khomp send command */
|
||||
static struct _KhompSendCommand : public Command
|
||||
{
|
||||
|
||||
@@ -231,6 +231,8 @@ struct KVoIPSeize
|
||||
|
||||
#define CM_USER_INFORMATION 0x0F
|
||||
|
||||
#define CM_USER_INFORMATION_EX 0x2B
|
||||
|
||||
#define CM_VOIP_SEIZE 0x23
|
||||
|
||||
|
||||
@@ -369,6 +371,8 @@ struct KVoIPSeize
|
||||
|
||||
#define EV_USER_INFORMATION 0x0F
|
||||
|
||||
#define EV_USER_INFORMATION_EX 0x1D
|
||||
|
||||
#define EV_DIALED_DIGIT 0x10
|
||||
|
||||
#define EV_SIP_REGISTER_INFO 0x11
|
||||
@@ -713,6 +717,8 @@ enum KH100CtbusFreq
|
||||
#define CM_START_CADENCE 0xA1
|
||||
|
||||
#define CM_STOP_CADENCE 0xA2
|
||||
|
||||
#define CM_SET_INPUT_MODE 0xA3
|
||||
#if !defined KR2D_H
|
||||
#define KR2D_H
|
||||
|
||||
@@ -925,6 +931,7 @@ enum KSignGroupII
|
||||
#ifndef _KISDN_H_
|
||||
#define _KISDN_H_
|
||||
#define KMAX_USER_USER_LEN 32
|
||||
#define KMAX_USER_USER_EX_LEN 254
|
||||
#define KMAX_SUBADRESS_INFORMATION_LEN 20
|
||||
|
||||
enum KQ931Cause
|
||||
@@ -1845,6 +1852,12 @@ struct KUserInformation
|
||||
int32 UserInfoLength;
|
||||
byte UserInfo[ KMAX_USER_USER_LEN ];
|
||||
};
|
||||
struct KUserInformationEx
|
||||
{
|
||||
int32 ProtocolDescriptor;
|
||||
int32 UserInfoLength;
|
||||
byte UserInfo[ KMAX_USER_USER_EX_LEN ];
|
||||
};
|
||||
struct KISDNSubaddressInformation
|
||||
{
|
||||
KQ931TypeOfSubaddress TypeOfSubaddress;
|
||||
|
||||
@@ -305,8 +305,6 @@ struct KhompPvt
|
||||
{
|
||||
try
|
||||
{
|
||||
//std::string type((name == "input_volume")?"input":"output");
|
||||
|
||||
int i = Strings::tolong(value);
|
||||
|
||||
if (i < -10 || i > 10)
|
||||
@@ -614,6 +612,7 @@ public:
|
||||
|
||||
virtual bool indicateRinging();
|
||||
virtual bool sendDtmf(std::string digit);
|
||||
virtual void cleanupIndications(bool force);
|
||||
|
||||
/* Methods */
|
||||
|
||||
@@ -849,7 +848,31 @@ public:
|
||||
if(!name)
|
||||
return NULL;
|
||||
|
||||
return switch_core_get_variable(name);
|
||||
#if SWITCH_LESS_THAN(1,0,6)
|
||||
const char * tmp = switch_core_get_variable(name);
|
||||
|
||||
if(!tmp) return NULL;
|
||||
|
||||
const char * val = strdup(tmp);
|
||||
|
||||
return val;
|
||||
#else
|
||||
return switch_core_get_variable_dup(name);
|
||||
#endif
|
||||
}
|
||||
|
||||
void freeFSGlobalVar(const char ** val)
|
||||
{
|
||||
if(!val || !*val) return;
|
||||
|
||||
#if SWITCH_LESS_THAN(1,0,6)
|
||||
free((void *)*val);
|
||||
*val = NULL;
|
||||
#else
|
||||
char * v = (char *)*val;
|
||||
switch_safe_free(v);
|
||||
*val=NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool mixer(const char *file, const char *func, int line,
|
||||
|
||||
@@ -138,7 +138,7 @@ struct KhompPvtFXO: public KhompPvt
|
||||
|
||||
TriState _var_fax_adjust;
|
||||
|
||||
//ChanTimer::Index _idx_disconnect;
|
||||
ChanTimer::Index _busy_disconnect;
|
||||
};
|
||||
/******************************************************************************/
|
||||
KhompPvtFXO(K3LAPIBase::GenericTarget & target) : KhompPvt(target)
|
||||
@@ -240,6 +240,7 @@ struct KhompPvtFXO: public KhompPvt
|
||||
bool autoGainControl(bool enable);
|
||||
void setAnswerInfo(int answer_info);
|
||||
bool indicateBusyUnlocked(int cause, bool sent_signaling = false);
|
||||
static void busyDisconnect(Board::KhompPvt * pvt);
|
||||
void reportFailToReceive(int fail_code);
|
||||
bool validContexts(MatchExtension::ContextListType & contexts,
|
||||
std::string extra_context = "");
|
||||
@@ -266,13 +267,20 @@ struct KhompPvtFXO: public KhompPvt
|
||||
|
||||
virtual bool cleanup(CleanupType type = CLN_HARD)
|
||||
{
|
||||
//Board::board(_target.device)->_timers.del(callFXO()->_idx_disconnect);
|
||||
//callFXO()->_idx_disconnect.reset();
|
||||
|
||||
try
|
||||
{
|
||||
Board::board(_target.device)->_timers.del(callFXO()->_busy_disconnect);
|
||||
}
|
||||
catch (K3LAPITraits::invalid_device & err)
|
||||
{
|
||||
LOG(ERROR, PVT_FMT(target(), "Unable to get device: %d!") % err.device);
|
||||
}
|
||||
|
||||
call()->_flags.clear(Kflags::CALL_WAIT_SEIZE);
|
||||
call()->_flags.clear(Kflags::EARLY_RINGBACK);
|
||||
|
||||
_transfer->clear();
|
||||
callFXO()->_busy_disconnect.reset();
|
||||
|
||||
switch (type)
|
||||
{
|
||||
@@ -312,6 +320,16 @@ struct KhompPvtFXO: public KhompPvt
|
||||
|
||||
// static void delayedDisconnect(Board::KhompPvt * pvt);
|
||||
|
||||
void cleanupIndications(bool force)
|
||||
{
|
||||
if (call()->_indication == INDICA_BUSY && !force)
|
||||
{
|
||||
DBG(FUNC, PVT_FMT(_target, "skipping busy indication cleanup on FXO channel."));
|
||||
return;
|
||||
}
|
||||
|
||||
KhompPvt::cleanupIndications(force);
|
||||
}
|
||||
};
|
||||
/******************************************************************************/
|
||||
/******************************************************************************/
|
||||
|
||||
@@ -272,24 +272,39 @@ struct KhompPvtISDN: public KhompPvtE1
|
||||
|
||||
bool process(std::string name, std::string value = "")
|
||||
{
|
||||
if (name == "uui")
|
||||
if ((name == "uui" ) || (name == "uui_ex"))
|
||||
{
|
||||
Strings::vector_type values;
|
||||
Strings::tokenize(value, values, "#", 2);
|
||||
|
||||
try
|
||||
if(value.find("#") != std::string::npos)
|
||||
{
|
||||
std::string uui_proto_s = values[0];
|
||||
std::string uui_data_s = values[1];
|
||||
Strings::vector_type values;
|
||||
Strings::tokenize(value, values, "#", 2);
|
||||
|
||||
_uui_descriptor = Strings::toulong(uui_proto_s);
|
||||
_uui_information.append(uui_data_s);
|
||||
try
|
||||
{
|
||||
std::string uui_proto_s = values[0];
|
||||
_uui_extended = (name == "uui_ex");
|
||||
_uui_descriptor = Strings::toulong(uui_proto_s);
|
||||
_uui_information.clear();
|
||||
|
||||
DBG(FUNC, FMT("uui adjusted (%s, '%s')!") % uui_proto_s.c_str() % uui_data_s.c_str());
|
||||
}
|
||||
catch (...)
|
||||
for (unsigned int i = 0; i < values[1].size(); ++i)
|
||||
_uui_information += STG(FMT("%02hhx") % ((unsigned char)values[1][i]));
|
||||
|
||||
DBG(FUNC, FMT("uui adjusted (ex=%s, proto=%s, data='%s')!")
|
||||
% (_uui_extended ? "true" : "false")
|
||||
% uui_proto_s.c_str()
|
||||
% _uui_information.c_str());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
LOG(ERROR, FMT("invalid %s protocol descriptor: '%s' is not a number.")
|
||||
% (_uui_extended ? "uui_ex" : "uui")
|
||||
% value.c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(ERROR, FMT("invalid uui protocol descriptor: '%s' is not a number.") % value.c_str());
|
||||
LOG(ERROR, FMT("invalid %s protocol descriptor, need a '#'.")
|
||||
% (_uui_extended ? "uui_ex" : "uui"))
|
||||
}
|
||||
}
|
||||
else if (name == "usr_xfer")
|
||||
@@ -306,6 +321,7 @@ struct KhompPvtISDN: public KhompPvtE1
|
||||
|
||||
bool clear()
|
||||
{
|
||||
_uui_extended = false;
|
||||
_uui_descriptor = -1;
|
||||
_uui_information.clear();
|
||||
_isdn_cause = -1;
|
||||
@@ -322,6 +338,7 @@ struct KhompPvtISDN: public KhompPvtE1
|
||||
long int _uui_descriptor;
|
||||
std::string _uui_information;
|
||||
long int _isdn_cause;
|
||||
bool _uui_extended;
|
||||
|
||||
/* what should we dial to trigger an user-signaled transfer? */
|
||||
/* used for xfer on user signaling */
|
||||
@@ -329,6 +346,13 @@ struct KhompPvtISDN: public KhompPvtE1
|
||||
std::string _user_xfer_buffer;
|
||||
std::string _digits_buffer;
|
||||
std::string _qsig_number;
|
||||
|
||||
/* isdn information */
|
||||
std::string _isdn_orig_type_of_number;
|
||||
std::string _isdn_orig_numbering_plan;
|
||||
std::string _isdn_dest_type_of_number;
|
||||
std::string _isdn_dest_numbering_plan;
|
||||
std::string _isdn_orig_presentation;
|
||||
|
||||
};
|
||||
/******************************************************************************/
|
||||
@@ -429,12 +453,29 @@ struct KhompPvtISDN: public KhompPvtE1
|
||||
|
||||
std::string descriptor = STG(FMT("%d") % callISDN()->_uui_descriptor);
|
||||
|
||||
setFSChannelVar("KUserInfoExtended", (callISDN()->_uui_extended ? "true" : "false"));
|
||||
setFSChannelVar("KUserInfoDescriptor", descriptor.c_str());
|
||||
setFSChannelVar("KUserInfoData", callISDN()->_uui_information.c_str());
|
||||
|
||||
callISDN()->_uui_extended = false;
|
||||
callISDN()->_uui_descriptor = -1;
|
||||
callISDN()->_uui_information.clear();
|
||||
}
|
||||
|
||||
if (!callISDN()->_isdn_orig_type_of_number.empty())
|
||||
setFSChannelVar("KISDNOrigTypeOfNumber", callISDN()->_isdn_orig_type_of_number.c_str());
|
||||
|
||||
if (!callISDN()->_isdn_dest_type_of_number.empty())
|
||||
setFSChannelVar("KISDNDestTypeOfNumber", callISDN()->_isdn_dest_type_of_number.c_str());
|
||||
|
||||
if (!callISDN()->_isdn_orig_numbering_plan.empty())
|
||||
setFSChannelVar("KISDNOrigNumberingPlan", callISDN()->_isdn_orig_numbering_plan.c_str());
|
||||
|
||||
if (!callISDN()->_isdn_dest_numbering_plan.empty())
|
||||
setFSChannelVar("KISDNDestNumberingPlan", callISDN()->_isdn_dest_numbering_plan.c_str());
|
||||
|
||||
if (!callISDN()->_isdn_orig_presentation.empty())
|
||||
setFSChannelVar("KISDNOrigPresentation", callISDN()->_isdn_orig_presentation.c_str());
|
||||
}
|
||||
catch(Board::KhompPvt::InvalidSwitchChannel & err)
|
||||
{
|
||||
@@ -444,8 +485,33 @@ struct KhompPvtISDN: public KhompPvtE1
|
||||
KhompPvtE1::setSpecialVariables();
|
||||
}
|
||||
|
||||
Transfer<CallISDN, false> * _transfer;
|
||||
virtual void getSpecialVariables()
|
||||
{
|
||||
try
|
||||
{
|
||||
const char * isdn_orig_type = getFSChannelVar("KISDNOrigTypeOfNumber");
|
||||
const char * isdn_dest_type = getFSChannelVar("KISDNDestTypeOfNumber");
|
||||
const char * isdn_orig_numbering = getFSChannelVar("KISDNOrigNumberingPlan");
|
||||
const char * isdn_dest_numbering = getFSChannelVar("KISDNDestNumberingPlan");
|
||||
const char * isdn_orig_presentation = getFSChannelVar("KISDNOrigPresentation");
|
||||
|
||||
LOG(ERROR, PVT_FMT(_target,"ISDNORIG: %s") % (isdn_orig_type ? isdn_orig_type : ""));
|
||||
|
||||
callISDN()->_isdn_orig_type_of_number = (isdn_orig_type ? isdn_orig_type : "");
|
||||
callISDN()->_isdn_dest_type_of_number = (isdn_dest_type ? isdn_dest_type : "");
|
||||
callISDN()->_isdn_orig_numbering_plan = (isdn_orig_numbering ? isdn_orig_numbering : "");
|
||||
callISDN()->_isdn_dest_numbering_plan = (isdn_dest_numbering ? isdn_dest_numbering : "");
|
||||
callISDN()->_isdn_orig_presentation = (isdn_orig_presentation ? isdn_orig_presentation : "");
|
||||
}
|
||||
catch(Board::KhompPvt::InvalidSwitchChannel & err)
|
||||
{
|
||||
LOG(ERROR, PVT_FMT(_target, "(ISDN) %s") % err._msg.c_str());
|
||||
}
|
||||
|
||||
KhompPvt::getSpecialVariables();
|
||||
}
|
||||
|
||||
Transfer<CallISDN, false> * _transfer;
|
||||
};
|
||||
/******************************************************************************/
|
||||
/********************************* R2 Channel *********************************/
|
||||
@@ -472,7 +538,6 @@ struct KhompPvtR2: public KhompPvtE1
|
||||
{
|
||||
LOG(ERROR, FMT("invalid r2 category: '%s' is not a number.") % value.c_str());
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -554,7 +619,23 @@ struct KhompPvtR2: public KhompPvtE1
|
||||
{
|
||||
return (CallR2 *)call();
|
||||
}
|
||||
|
||||
|
||||
bool forceDisconnect(void)
|
||||
{
|
||||
char cmd[] = { 0x07, (char)(_target.object + 1) };
|
||||
|
||||
try
|
||||
{
|
||||
Globals::k3lapi.raw_command(_target.device, 0, cmd, sizeof(cmd));
|
||||
}
|
||||
catch(K3LAPI::failed_raw_command &e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
int makeCall(std::string params = "");
|
||||
bool doChannelAnswer(CommandRequest &);
|
||||
bool doChannelHangup(CommandRequest &);
|
||||
@@ -609,9 +690,9 @@ struct KhompPvtR2: public KhompPvtE1
|
||||
/* r2 caller category */
|
||||
if (callR2()->_r2_category != -1)
|
||||
{
|
||||
setFSChannelVar("KR2GotCategory",Verbose::signGroupII((KSignGroupII)callR2()->_r2_category).c_str());
|
||||
setFSChannelVar("KR2GotCategory",STG(FMT("%d") % callR2()->_r2_category).c_str());
|
||||
setFSChannelVar("KR2StrCategory",Verbose::signGroupII((KSignGroupII)callR2()->_r2_category).c_str());
|
||||
}
|
||||
|
||||
}
|
||||
catch(Board::KhompPvt::InvalidSwitchChannel & err)
|
||||
{
|
||||
@@ -834,9 +915,9 @@ struct KhompPvtFXS: public KhompPvt
|
||||
_ring_off_ext = -1;
|
||||
|
||||
_incoming_exten.clear();
|
||||
_flash_transfer.clear();
|
||||
//_flash_transfer.clear();
|
||||
|
||||
_uuid_other_session.clear();
|
||||
//_uuid_other_session.clear();
|
||||
|
||||
return Call::clear();
|
||||
}
|
||||
@@ -850,10 +931,10 @@ struct KhompPvtFXS: public KhompPvt
|
||||
|
||||
std::string _incoming_exten;
|
||||
|
||||
ChanTimer::Index _idx_transfer;
|
||||
//ChanTimer::Index _idx_transfer;
|
||||
|
||||
std::string _flash_transfer;
|
||||
std::string _uuid_other_session;
|
||||
//std::string _flash_transfer;
|
||||
//std::string _uuid_other_session;
|
||||
|
||||
|
||||
};
|
||||
@@ -936,9 +1017,9 @@ struct KhompPvtFXS: public KhompPvt
|
||||
std::string extra_context = "");
|
||||
bool isOK(void);
|
||||
|
||||
bool startTransfer();
|
||||
bool stopTransfer();
|
||||
bool transfer(std::string & context, bool blind = false);
|
||||
//bool startTransfer();
|
||||
//bool stopTransfer();
|
||||
//bool transfer(std::string & context, bool blind = false);
|
||||
|
||||
bool hasNumberDial() { return false; }
|
||||
|
||||
@@ -996,7 +1077,7 @@ struct KhompPvtFXS: public KhompPvt
|
||||
|
||||
static OrigToNseqMapType generateNseqMap();
|
||||
static void dialTimer(KhompPvt * pvt);
|
||||
static void transferTimer(KhompPvt * pvt);
|
||||
//static void transferTimer(KhompPvt * pvt);
|
||||
|
||||
static std::string padOrig(std::string orig_base, unsigned int padding)
|
||||
{
|
||||
@@ -1015,21 +1096,16 @@ struct KhompPvtFXS: public KhompPvt
|
||||
return STG(FMT(STG(FMT("%%0%dd") % orig_size)) % (orig_numb + padding));
|
||||
}
|
||||
|
||||
/*
|
||||
virtual void getSpecialVariables()
|
||||
void cleanupIndications(bool force)
|
||||
{
|
||||
try
|
||||
if (call()->_indication == INDICA_BUSY && !force)
|
||||
{
|
||||
}
|
||||
catch(Board::KhompPvt::InvalidSwitchChannel & err)
|
||||
{
|
||||
LOG(ERROR, PVT_FMT(_target, "(FXS) %s") % err._msg.c_str());
|
||||
DBG(FUNC, PVT_FMT(_target, "skipping busy indication cleanup on FXS channel."));
|
||||
return;
|
||||
}
|
||||
|
||||
KhompPvt::getSpecialVariables();
|
||||
KhompPvt::cleanupIndications(force);
|
||||
}
|
||||
*/
|
||||
|
||||
};
|
||||
/******************************************************************************/
|
||||
/******************************************************************************/
|
||||
|
||||
@@ -108,10 +108,13 @@ struct Options
|
||||
Config::Value< bool > _recording;
|
||||
Config::Value< bool > _has_ctbus;
|
||||
Config::Value< bool > _fxs_bina;
|
||||
Config::Value< bool > _fxo_send_pre_audio;
|
||||
Config::Value< bool > _fxs_sharp_dial;
|
||||
Config::Value< bool > _drop_collect_call;
|
||||
Config::Value< bool > _ignore_letter_dtmfs;
|
||||
Config::Value< bool > _optimize_audio_path;
|
||||
|
||||
Config::Value< bool > _fxo_send_pre_audio;
|
||||
Config::Value< unsigned int > _fxo_busy_disconnection;
|
||||
|
||||
Config::Value< bool > _auto_fax_adjustment;
|
||||
Config::Value< unsigned int > _fax_adjustment_timeout;
|
||||
|
||||
@@ -1 +1 @@
|
||||
#define MOD_KHOMP_VERSION "1.0 - (rev: 5891)"
|
||||
#define MOD_KHOMP_VERSION "1.0 - (rev: 6034)"
|
||||
Reference in new issue
Block a user