Make caller id per account option available. Needs to wipe out the ~/.fscomm/conf/freeswitch.xml file, sorry.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16529 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
João Mesquita 2010-01-28 03:13:57 +00:00
parent 8a3001e611
commit 6a939c199a
6 changed files with 330 additions and 249 deletions

View File

@ -1,102 +1,102 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<document type="freeswitch/xml"> <document type="freeswitch/xml">
<X-PRE-PROCESS cmd="set" data="auto_answer=false"/> <X-PRE-PROCESS cmd="set" data="auto_answer=false"/>
<X-PRE-PROCESS cmd="set" data="domain=$${local_ip_v4}"/> <X-PRE-PROCESS cmd="set" data="domain=$${local_ip_v4}"/>
<X-PRE-PROCESS cmd="set" data="hold_music=local_stream://moh"/> <X-PRE-PROCESS cmd="set" data="hold_music=local_stream://moh"/>
<X-PRE-PROCESS cmd="set" data="codec_prefs=CELT@48000h,G7221@32000h,G7221@16000h,G722,PCMU,PCMA,GSM"/> <X-PRE-PROCESS cmd="set" data="codec_prefs=CELT@48000h,G7221@32000h,G7221@16000h,G722,PCMU,PCMA,GSM"/>
<X-PRE-PROCESS cmd="set" data="external_rtp_ip=stun:stun.freeswitch.org"/> <X-PRE-PROCESS cmd="set" data="external_rtp_ip=stun:stun.freeswitch.org"/>
<X-PRE-PROCESS cmd="set" data="external_sip_ip=stun:stun.freeswitch.org"/> <X-PRE-PROCESS cmd="set" data="external_sip_ip=stun:stun.freeswitch.org"/>
<X-PRE-PROCESS cmd="set" data="console_loglevel=info"/> <X-PRE-PROCESS cmd="set" data="console_loglevel=info"/>
<X-PRE-PROCESS cmd="set" data="us-ring=%(2000, 4000, 440.0, 480.0)"/> <X-PRE-PROCESS cmd="set" data="us-ring=%(2000, 4000, 440.0, 480.0)"/>
<X-PRE-PROCESS cmd="set" data="bong-ring=v=-7;%(100,0,941.0,1477.0);v=-7;>=2;+=.1;%(1400,0,350,440)"/> <X-PRE-PROCESS cmd="set" data="bong-ring=v=-7;%(100,0,941.0,1477.0);v=-7;>=2;+=.1;%(1400,0,350,440)"/>
<X-PRE-PROCESS cmd="set" data="sit=%(274,0,913.8);%(274,0,1370.6);%(380,0,1776.7)"/> <X-PRE-PROCESS cmd="set" data="sit=%(274,0,913.8);%(274,0,1370.6);%(380,0,1776.7)"/>
<section name="configuration" description="Various Configuration"> <section name="configuration" description="Various Configuration">
<configuration name="cdr_csv.conf" description="CDR CSV Format"> <configuration name="cdr_csv.conf" description="CDR CSV Format">
<settings> <settings>
<param name="default-template" value="example"/> <param name="default-template" value="example"/>
<param name="rotate-on-hup" value="true"/> <param name="rotate-on-hup" value="true"/>
<param name="legs" value="a"/> <param name="legs" value="a"/>
</settings> </settings>
<templates> <templates>
<template name="example">"${caller_id_name}","${caller_id_number}","${destination_number}","${context}","${start_stamp}","${answer_stamp}","${end_stamp}","${duration}","${billsec}","${hangup_cause}","${uuid}","${bleg_uuid}","${accountcode}","${read_codec}","${write_codec}"</template> <template name="example">"${caller_id_name}","${caller_id_number}","${destination_number}","${context}","${start_stamp}","${answer_stamp}","${end_stamp}","${duration}","${billsec}","${hangup_cause}","${uuid}","${bleg_uuid}","${accountcode}","${read_codec}","${write_codec}"</template>
</templates> </templates>
</configuration> </configuration>
<configuration name="console.conf" description="Console Logger"> <configuration name="console.conf" description="Console Logger">
<mappings> <mappings>
<map name="all" value="console,debug,info,notice,warning,err,crit,alert"/> <map name="all" value="console,debug,info,notice,warning,err,crit,alert"/>
</mappings> </mappings>
<settings> <settings>
<param name="colorize" value="true"/> <param name="colorize" value="true"/>
<param name="loglevel" value="$${console_loglevel}"/> <param name="loglevel" value="$${console_loglevel}"/>
</settings> </settings>
</configuration> </configuration>
<configuration name="enum.conf" description="ENUM Module"> <configuration name="enum.conf" description="ENUM Module">
<settings> <settings>
<param name="default-root" value="e164.org"/> <param name="default-root" value="e164.org"/>
<param name="default-isn-root" value="freenum.org"/> <param name="default-isn-root" value="freenum.org"/>
<param name="query-timeout" value="10"/> <param name="query-timeout" value="10"/>
<param name="auto-reload" value="true"/> <param name="auto-reload" value="true"/>
</settings> </settings>
<routes> <routes>
<route service="E2U+SIP" regex="sip:(.*)" replace="sofia/softphone/$1"/> <route service="E2U+SIP" regex="sip:(.*)" replace="sofia/softphone/$1"/>
</routes> </routes>
</configuration> </configuration>
<configuration name="qsettings.conf" description="configures our mod_qsettings"> <configuration name="qsettings.conf" description="configures our mod_qsettings">
<bindings value="configuration" /> <bindings value="configuration" />
</configuration> </configuration>
<configuration name="local_stream.conf" description="stream files from local dir"> <configuration name="local_stream.conf" description="stream files from local dir">
<directory name="moh/48000" path="$${base_dir}/sounds/music/48000"> <directory name="moh/48000" path="$${base_dir}/sounds/music/48000">
<param name="rate" value="48000"/> <param name="rate" value="48000"/>
<param name="shuffle" value="true"/> <param name="shuffle" value="true"/>
<param name="channels" value="1"/> <param name="channels" value="1"/>
<param name="interval" value="10"/> <param name="interval" value="10"/>
<param name="timer-name" value="soft"/> <param name="timer-name" value="soft"/>
</directory> </directory>
</configuration> </configuration>
<configuration name="logfile.conf" description="File Logging"> <configuration name="logfile.conf" description="File Logging">
<settings> <settings>
<param name="rotate-on-hup" value="true"/> <param name="rotate-on-hup" value="true"/>
</settings> </settings>
<profiles> <profiles>
<profile name="default"> <profile name="default">
<settings> <settings>
</settings> </settings>
<mappings> <mappings>
<map name="all" value="debug,info,notice,warning,err,crit,alert"/> <map name="all" value="debug,info,notice,warning,err,crit,alert"/>
</mappings> </mappings>
</profile> </profile>
</profiles> </profiles>
</configuration> </configuration>
<configuration name="modules.conf" description="Modules"> <configuration name="modules.conf" description="Modules">
<modules> <modules>
<load module="mod_console"/> <load module="mod_console"/>
<load module="mod_logfile"/> <load module="mod_logfile"/>
<load module="mod_enum"/> <load module="mod_enum"/>
<load module="mod_cdr_csv"/> <load module="mod_cdr_csv"/>
<load module="mod_sofia"/> <load module="mod_sofia"/>
<load module="mod_loopback"/> <load module="mod_loopback"/>
<load module="mod_commands"/> <load module="mod_commands"/>
<load module="mod_dptools"/> <load module="mod_dptools"/>
<load module="mod_dialplan_xml"/> <load module="mod_dialplan_xml"/>
<load module="mod_voipcodecs"/> <load module="mod_voipcodecs"/>
<load module="mod_ilbc"/> <load module="mod_ilbc"/>
<load module="mod_speex"/> <load module="mod_speex"/>
<load module="mod_celt"/> <load module="mod_celt"/>
<load module="mod_siren"/> <load module="mod_siren"/>
<load module="mod_sndfile"/> <load module="mod_sndfile"/>
<load module="mod_tone_stream"/> <load module="mod_tone_stream"/>
<load module="mod_local_stream"/> <load module="mod_local_stream"/>
<load module="mod_portaudio"/> <load module="mod_portaudio"/>
<load module="mod_event_socket"/> <load module="mod_event_socket"/>
</modules> </modules>
</configuration> </configuration>
<configuration name="portaudio.conf" description="Soundcard Endpoint"> <configuration name="portaudio.conf" description="Soundcard Endpoint">
<settings> <settings>
@ -125,166 +125,185 @@
</settings> </settings>
</configuration> </configuration>
<configuration name="post_load_modules.conf" description="Modules"> <configuration name="post_load_modules.conf" description="Modules">
<modules> <modules>
</modules> </modules>
</configuration> </configuration>
<configuration name="sofia.conf" description="sofia Endpoint"> <configuration name="sofia.conf" description="sofia Endpoint">
<global_settings> <global_settings>
<param name="log-level" value="0"/> <param name="log-level" value="0"/>
<param name="auto-restart" value="true"/> <param name="auto-restart" value="true"/>
<param name="debug-presence" value="0"/> <param name="debug-presence" value="0"/>
</global_settings> </global_settings>
<profiles> <profiles>
<profile name="softphone"> <profile name="softphone">
<settings> <settings>
<!--<param name="media-option" value="bypass-media-after-att-xfer"/>--> <!--<param name="media-option" value="bypass-media-after-att-xfer"/>-->
<param name="user-agent-string" value="FreeSWITCH/FSComm"/> <param name="user-agent-string" value="FreeSWITCH/FSComm"/>
<!-- <param name="user-agent-string" value="FreeSWITCH Rocks!"/> --> <!-- <param name="user-agent-string" value="FreeSWITCH Rocks!"/> -->
<param name="debug" value="0"/> <param name="debug" value="0"/>
<param name="sip-trace" value="no"/> <param name="sip-trace" value="no"/>
<param name="context" value="public"/> <param name="context" value="public"/>
<param name="rfc2833-pt" value="101"/> <param name="rfc2833-pt" value="101"/>
<!-- port to bind to for sip traffic --> <!-- port to bind to for sip traffic -->
<param name="sip-port" value="12345"/> <param name="sip-port" value="12345"/>
<param name="dialplan" value="XML"/> <param name="dialplan" value="XML"/>
<param name="dtmf-duration" value="100"/> <param name="dtmf-duration" value="100"/>
<param name="codec-prefs" value="$${codec_prefs}"/> <param name="codec-prefs" value="$${codec_prefs}"/>
<param name="use-rtp-timer" value="true"/> <param name="use-rtp-timer" value="true"/>
<param name="rtp-timer-name" value="soft"/> <param name="rtp-timer-name" value="soft"/>
<!-- ip address to use for rtp, DO NOT USE HOSTNAMES ONLY IP ADDRESSES --> <!-- ip address to use for rtp, DO NOT USE HOSTNAMES ONLY IP ADDRESSES -->
<param name="rtp-ip" value="$${local_ip_v4}"/> <param name="rtp-ip" value="$${local_ip_v4}"/>
<!-- ip address to bind to, DO NOT USE HOSTNAMES ONLY IP ADDRESSES --> <!-- ip address to bind to, DO NOT USE HOSTNAMES ONLY IP ADDRESSES -->
<param name="sip-ip" value="$${local_ip_v4}"/> <param name="sip-ip" value="$${local_ip_v4}"/>
<param name="hold-music" value="$${hold_music}"/> <param name="hold-music" value="$${hold_music}"/>
<param name="apply-nat-acl" value="rfc1918"/> <param name="apply-nat-acl" value="rfc1918"/>
<!--<param name="enable-timer" value="false"/>--> <!--<param name="enable-timer" value="false"/>-->
<!--<param name="enable-100rel" value="true"/>--> <!--<param name="enable-100rel" value="true"/>-->
<!--<param name="minimum-session-expires" value="120"/>--> <!--<param name="minimum-session-expires" value="120"/>-->
<!--<param name="dtmf-type" value="info"/>--> <!--<param name="dtmf-type" value="info"/>-->
<param name="manage-presence" value="false"/> <param name="manage-presence" value="false"/>
<!--<param name="bitpacking" value="aal2"/> --> <!--<param name="bitpacking" value="aal2"/> -->
<param name="max-proceeding" value="3"/> <param name="max-proceeding" value="3"/>
<!--<param name="session-timeout" value="120"/>--> <!--<param name="session-timeout" value="120"/>-->
<!--set to 'greedy' if you want your codec list to take precedence --> <!--set to 'greedy' if you want your codec list to take precedence -->
<param name="inbound-codec-negotiation" value="generous"/> <param name="inbound-codec-negotiation" value="generous"/>
<!-- if you want to send any special bind params of your own --> <!-- if you want to send any special bind params of your own -->
<!--<param name="bind-params" value="transport=udp"/>--> <!--<param name="bind-params" value="transport=udp"/>-->
<!--Uncomment to let calls hit the dialplan *before* you decide if the codec is ok--> <!--Uncomment to let calls hit the dialplan *before* you decide if the codec is ok-->
<!--<param name="inbound-late-negotiation" value="true"/>--> <!--<param name="inbound-late-negotiation" value="true"/>-->
<!--<param name="accept-blind-reg" value="true"/> --> <!--<param name="accept-blind-reg" value="true"/> -->
<!--<param name="accept-blind-auth" value="true"/> --> <!--<param name="accept-blind-auth" value="true"/> -->
<!--<param name="suppress-cng" value="true"/> --> <!--<param name="suppress-cng" value="true"/> -->
<param name="nonce-ttl" value="60"/> <param name="nonce-ttl" value="60"/>
<!--<param name="NDLB-broken-auth-hash" value="true"/>--> <!--<param name="NDLB-broken-auth-hash" value="true"/>-->
<!--<param name="NDLB-received-in-nat-reg-contact" value="true"/>--> <!--<param name="NDLB-received-in-nat-reg-contact" value="true"/>-->
<param name="auth-calls" value="false"/> <param name="auth-calls" value="false"/>
<param name="auth-all-packets" value="false"/> <param name="auth-all-packets" value="false"/>
<param name="ext-rtp-ip" value="$${external_rtp_ip}"/> <param name="ext-rtp-ip" value="$${external_rtp_ip}"/>
<param name="ext-sip-ip" value="$${external_sip_ip}"/> <param name="ext-sip-ip" value="$${external_sip_ip}"/>
<!-- rtp inactivity timeout --> <!-- rtp inactivity timeout -->
<param name="rtp-timeout-sec" value="300"/> <param name="rtp-timeout-sec" value="300"/>
<param name="rtp-hold-timeout-sec" value="1800"/> <param name="rtp-hold-timeout-sec" value="1800"/>
<!-- VAD choose one (out is a good choice); --> <!-- VAD choose one (out is a good choice); -->
<!-- <param name="vad" value="in"/> --> <!-- <param name="vad" value="in"/> -->
<!-- <param name="vad" value="out"/> --> <!-- <param name="vad" value="out"/> -->
<!-- <param name="vad" value="both"/> --> <!-- <param name="vad" value="both"/> -->
<param name="disable-register" value="true"/> <param name="disable-register" value="true"/>
<!--<param name="NDLB-force-rport" value="true"/>--> <!--<param name="NDLB-force-rport" value="true"/>-->
<param name="challenge-realm" value="auto_from"/> <param name="challenge-realm" value="auto_from"/>
<!--<param name="disable-rtp-auto-adjust" value="true"/>--> <!--<param name="disable-rtp-auto-adjust" value="true"/>-->
<!--<param name="inbound-use-callid-as-uuid" value="true"/>--> <!--<param name="inbound-use-callid-as-uuid" value="true"/>-->
<!--<param name="outbound-use-uuid-as-callid" value="true"/>--> <!--<param name="outbound-use-uuid-as-callid" value="true"/>-->
<!--<param name="auto-rtp-bugs" data="clear"/>--> <!--<param name="auto-rtp-bugs" data="clear"/>-->
</settings> </settings>
</profile> </profile>
</profiles> </profiles>
</configuration> </configuration>
<configuration name="switch.conf" description="Core Configuration"> <configuration name="switch.conf" description="Core Configuration">
<cli-keybindings> <cli-keybindings>
<key name="1" value="help"/> <key name="1" value="help"/>
<key name="2" value="status"/> <key name="2" value="status"/>
<key name="3" value="pa answer"/> <key name="3" value="pa answer"/>
<key name="4" value="pa hangup"/> <key name="4" value="pa hangup"/>
<key name="5" value="sofia status"/> <key name="5" value="sofia status"/>
<key name="6" value="reloadxml"/> <key name="6" value="reloadxml"/>
<key name="7" value="console loglevel 0"/> <key name="7" value="console loglevel 0"/>
<key name="8" value="console loglevel 7"/> <key name="8" value="console loglevel 7"/>
<key name="9" value="sofia status profile softphone"/> <key name="9" value="sofia status profile softphone"/>
<key name="10" value="fsctl pause"/> <key name="10" value="fsctl pause"/>
<key name="11" value="fsctl resume"/> <key name="11" value="fsctl resume"/>
<key name="12" value="version"/> <key name="12" value="version"/>
</cli-keybindings> </cli-keybindings>
<settings> <settings>
<param name="colorize-console" value="true"/> <param name="colorize-console" value="true"/>
<param name="max-sessions" value="20"/> <param name="max-sessions" value="20"/>
<param name="sessions-per-second" value="5"/> <param name="sessions-per-second" value="5"/>
<param name="loglevel" value="debug"/> <param name="loglevel" value="debug"/>
<param name="crash-protection" value="false"/> <param name="crash-protection" value="false"/>
<param name="dump-cores" value="yes"/> <param name="dump-cores" value="yes"/>
<param name="rtp-start-port" value="16384"/> <param name="rtp-start-port" value="16384"/>
<param name="rtp-end-port" value="16484"/> <param name="rtp-end-port" value="16484"/>
</settings> </settings>
</configuration> </configuration>
</section> </section>
<section name="dialplan" description="Regex/XML Dialplan"> <section name="dialplan" description="Regex/XML Dialplan">
<context name="default"> <context name="default">
<extension name="codec_and_sip_uri"> <extension name="codec_and_sip_uri">
<condition field="destination_number" expression="^sip:(.*):(.*)$"> <condition field="destination_number" expression="^sip:(.*):(.*)$">
<action application="bridge" data="{absolute_codec_string=$1}sofia/softphone/$2"/> <action application="export" data="origination_caller_id_number=${fscomm_caller_id_num}"/>
</condition> <action application="export" data="origination_caller_id_name=${fscomm_caller_id_name}"/>
</extension> <action application="info"/>
<extension name="sip_uri"> <action application="bridge" data="{absolute_codec_string=$1}sofia/softphone/$2"/>
<condition field="destination_number" expression="^sip:(.*)$"> </condition>
<action application="bridge" data="sofia/softphone/$1"/> </extension>
</condition> <extension name="sip_uri">
</extension> <condition field="destination_number" expression="^sip:(.*)$">
<extension name="codec_and_number"> <action application="export" data="origination_caller_id_number=${fscomm_caller_id_num}"/>
<condition field="destination_number" expression="^(.*):(.*)@(.*)$"> <action application="export" data="origination_caller_id_name=${fscomm_caller_id_name}"/>
<action application="bridge" data="{absolute_codec_string=$1}sofia/gateway/$3/$2"/> <action application="info"/>
</condition> <action application="bridge" data="sofia/softphone/$1"/>
</extension> </condition>
<extension name="number"> </extension>
<condition field="destination_number" expression="^(.*)@(.*)$"> <extension name="codec_and_number">
<action application="bridge" data="sofia/gateway/$2/$1"/> <condition field="destination_number" expression="^(.*):(.*)@(.*)$">
</condition> <action application="export" data="origination_caller_id_number=${fscomm_caller_id_num}"/>
</extension> <action application="export" data="origination_caller_id_name=${fscomm_caller_id_name}"/>
<extension name="number"> <action application="info"/>
<condition field="destination_number" expression="^(.*)$"> <action application="bridge" data="{absolute_codec_string=$1}sofia/gateway/$3/$2"/>
</condition>
</extension>
<extension name="number">
<condition field="destination_number" expression="^(.*)@(.*)$">
<action application="export" data="origination_caller_id_number=${fscomm_caller_id_num}"/>
<action application="export" data="origination_caller_id_name=${fscomm_caller_id_name}"/>
<action application="info"/>
<action application="bridge" data="sofia/gateway/$2/$1"/>
</condition>
</extension>
<extension name="number">
<condition field="destination_number" expression="^(.*)$">
<!-- Default gateway is set by FSComm when default account is selected --> <!-- Default gateway is set by FSComm when default account is selected -->
<action application="bridge" data="sofia/gateway/${default_gateway}/$1"/> <action application="export" data="origination_caller_id_number=${fscomm_caller_id_num}"/>
</condition> <action application="export" data="origination_caller_id_name=${fscomm_caller_id_name}"/>
</extension> <action application="info"/>
</context> <action application="bridge" data="sofia/gateway/${default_gateway}/$1"/>
<context name="public"> </condition>
<extension name="public_extensions"> </extension>
<condition field="$${auto_answer}" expression="^true$"/> </context>
<condition field="destination_number" expression="^(.*)$"> <context name="public">
<action application="info"/> <extension name="public_extensions">
<action application="bridge" data="portaudio/auto_answer"/> <condition field="$${auto_answer}" expression="^true$"/>
</condition> <condition field="destination_number" expression="^(.*)$">
</extension> <action application="export" data="origination_caller_id_number=${fscomm_caller_id_num}"/>
<extension name="public_extensions"> <action application="export" data="origination_caller_id_name=${fscomm_caller_id_name}"/>
<condition field="${sip_to_params}" expression="intercom=true"/> <action application="info"/>
<condition field="${alert_info}" expression="Ring;Answer"/> <action application="bridge" data="portaudio/auto_answer"/>
<condition field="destination_number" expression="^(.*)$"> </condition>
<action application="info"/> </extension>
<action application="bridge" data="portaudio/auto_answer"/> <extension name="public_extensions">
</condition> <condition field="${sip_to_params}" expression="intercom=true"/>
</extension> <condition field="${alert_info}" expression="Ring;Answer"/>
<extension name="public_extensions"> <condition field="destination_number" expression="^(.*)$">
<condition field="destination_number" expression="^(.*)$"> <action application="export" data="origination_caller_id_number=${fscomm_caller_id_num}"/>
<action application="info"/> <action application="export" data="origination_caller_id_name=${fscomm_caller_id_name}"/>
<action application="set" data="ringback=${us-ring}"/> <action application="info"/>
<action application="pre_answer"/> <action application="bridge" data="portaudio/auto_answer"/>
<action application="bridge" data="portaudio"/> </condition>
</condition> </extension>
</extension> <extension name="public_extensions">
</context> <condition field="destination_number" expression="^(.*)$">
</section> <action application="export" data="origination_caller_id_number=${fscomm_caller_id_num}"/>
<action application="export" data="origination_caller_id_name=${fscomm_caller_id_name}"/>
<action application="info"/>
<action application="set" data="ringback=${us-ring}"/>
<action application="pre_answer"/>
<action application="bridge" data="portaudio"/>
</condition>
</extension>
</context>
</section>
</document> </document>

View File

@ -485,3 +485,22 @@ void FSHost::printEventHeaders(switch_event_t *event)
} }
qDebug() << "\n\n"; qDebug() << "\n\n";
} }
QSharedPointer<Account> FSHost::getAccountByName(QString accStr)
{
foreach(QSharedPointer<Account> acc, _accounts.values())
{
if (acc.data()->getName() == accStr)
return acc;
}
return QSharedPointer<Account>();
}
QSharedPointer<Account> FSHost::getCurrentDefaultAccount()
{
QSettings settings;
settings.beginGroup("FreeSWITCH/conf/globals");
QString accString = settings.value("default_gateway").toString();
settings.endGroup();
return getAccountByName(accString);
}

View File

@ -47,6 +47,8 @@ public:
QSharedPointer<Call> getCurrentActiveCall(); QSharedPointer<Call> getCurrentActiveCall();
QList<QSharedPointer<Account> > getAccounts() { return _accounts.values(); } QList<QSharedPointer<Account> > getAccounts() { return _accounts.values(); }
QSharedPointer<Account> getAccountByUUID(QString uuid); QSharedPointer<Account> getAccountByUUID(QString uuid);
QSharedPointer<Account> getCurrentDefaultAccount();
QSharedPointer<Account> getAccountByName(QString accStr);
void accountReloadCmd(QSharedPointer<Account> acc); void accountReloadCmd(QSharedPointer<Account> acc);
protected: protected:

View File

@ -239,6 +239,36 @@ void MainWindow::makeCall()
QString dialstring = QInputDialog::getText(this, tr("Make new call"), QString dialstring = QInputDialog::getText(this, tr("Make new call"),
tr("Number to dial:"), QLineEdit::Normal, NULL,&ok); tr("Number to dial:"), QLineEdit::Normal, NULL,&ok);
QSharedPointer<Account> acc = g_FSHost.getCurrentDefaultAccount();
if (!acc.isNull()) {
QSettings settings;
settings.beginGroup("FreeSWITCH/conf/sofia.conf/profiles/profile/gateways/");
settings.beginGroup(acc.data()->getUUID());
settings.beginGroup("gateway/global_vars");
QString cidName = settings.value("caller_id_name").toString();
QString cidNum = settings.value("caller_id_num").toString();
settings.endGroup();
settings.endGroup();
settings.endGroup();
if (cidName.isEmpty()) {
settings.beginGroup("FreeSWITCH/conf/portaudio.conf/settings/params");
cidName = settings.value("cid-name").toString();
settings.endGroup();
}
if (cidNum.isEmpty()) {
settings.beginGroup("FreeSWITCH/conf/portaudio.conf/settings/params");
cidNum = settings.value("cid-num").toString();
settings.endGroup();
}
/* Set the vars for this call */
switch_core_set_variable("fscomm_caller_id_name", cidName.toAscii().data());
switch_core_set_variable("fscomm_caller_id_num", cidNum.toAscii().data());
qDebug() << "Name:" << cidName << "Num:" << cidNum;
}
if (ok && !dialstring.isEmpty()) if (ok && !dialstring.isEmpty())
{ {
paCall(dialstring); paCall(dialstring);

View File

@ -137,6 +137,17 @@ void AccountDialog::writeConfig()
_settings->beginGroup("FreeSWITCH/conf/sofia.conf/profiles/profile/gateways"); _settings->beginGroup("FreeSWITCH/conf/sofia.conf/profiles/profile/gateways");
_settings->beginGroup(_accId); _settings->beginGroup(_accId);
_settings->beginGroup("gateway/global_vars");
if (ui->clidSettingsCombo->currentIndex() == 0)
{
_settings->remove("caller_id_name");
_settings->remove("caller_id_num");
} else {
_settings->setValue("caller_id_name", ui->sofiaCallerIDName->text());
_settings->setValue("caller_id_num", ui->sofiaCallerIDNum->text());
}
_settings->endGroup();
_settings->beginGroup("gateway/attrs"); _settings->beginGroup("gateway/attrs");
_settings->setValue("name", ui->sofiaGwNameEdit->text()); _settings->setValue("name", ui->sofiaGwNameEdit->text());

View File

@ -193,7 +193,7 @@
<item row="9" column="1"> <item row="9" column="1">
<widget class="QComboBox" name="clidSettingsCombo"> <widget class="QComboBox" name="clidSettingsCombo">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>true</bool>
</property> </property>
<item> <item>
<property name="text"> <property name="text">