asterisk call from file - call

i want to use the call from file system.
the file.call looks like this:
;------------------------------------
Channel: Dongle/dongle0/07xxxxxxxx
MaxRetries: 2
RetryTime: 60
WaitTime: 30
Context: testing
Extension: 07xxxxxxxx
CallerID: 07xxxxxxxy
Priority: 1
;------------------------------------
extension.cof like this:
;--------------------------------------------------------------------------
[testing]
exten => s,1,Answer()
exten => s,n(lbl_testing_0),Set(TIMEOUT(response)=10)
exten => s,n,Set(TIMEOUT(digit)=1)
exten => s,n,Background(custom/nice_sound)
exten => s,n,WaitExten(10,m())
exten => s,n,Hangup()
exten => 1,1,SayDigits(1)
exten => 1,n,Playback(tts/sound1)
;exten => 1,n,System(/bin/echo "peresed key 1 and save in txt and mysql after" >> /var/spool/asterisk/key1.txt)
exten => 1,n,MYSQL(Connect connid 127.0.0.1 asterisk password asterisk)
exten => 1,n,MYSQL(Query resultid ${connid} INSERT INTO `keys` (`key`,`number`,`date`) VALUES (${EXTEN},${CALLERID(num)},now()))
exten => 1,n,MYSQL(Disconnect ${connid})
exten => 1,n(lbl_testing_1),Hangup()
exten => 2,1,SayDigits(3)
exten => 2,n,Playback(tts/sound2)
exten => 2,n,Goto(1,lbl_testing_1)
exten => 3,1,SayDigits(3)
exten => 3,n,Playback(tts/sound3)
exten => 3,n,Goto(1,lbl_testing_1)
exten => 4,1,Playback(tts/sound4)
exten => 4,n,Goto(s,lbl_testing_0)
exten => i,1,Playback(invalidValue)
exten => i,n,Goto(s,lbl_testing_0)
exten => t,1,Playback(timeout)
exten => t,n,Goto(s,lbl_testing_0)
exten => 111,1,Dial(PJSIP/111)
exten => 111,n,GotoIf($["${DIALSTATUS}" = "CHANUNAVAIL"]?lbl_testing_3:)
exten => 111,n,GotoIf($["${DIALSTATUS}" = "NOANSWER"]?lbl_testing_3:)
exten => 111,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?lbl_testing_3:)
exten => 111,n(lbl_testing_2),Hangup()
exten => 111,n(lbl_testing_3),VoiceMail(testing#111,s)
exten => 111,n,Goto(lbl_testing_2)
;--------------------------------------------------------------------------
Somehow it works.
The question is: how do i put this dialplan only in the file.call and no longer use [testing] from extension.conf and all the settings to make it in that file.call that i automatically move to /var/spool/asterisk/outgoing
I tried like this:
;------------------------------------
Channel: Dongle/dongle0/07xxxxxxxx
MaxRetries: 2
RetryTime: 60
WaitTime: 30
Extension: 07xxxxxxxx
CallerID: 07xxxxxxxy
Application: Playback
Data: custom/nice_sound
;------------------------------------
but i can't find how to add the rest of the dialplan settings and save in mysql
does anyone know how? is it possible to work like this or i'm too dreamy?
thank you very much!

Call files designed to make call request. It not intended to use as dialplan replacement.
There is no way to put complex dialplan in callfile.
Only things you can do is set some variables via Set: construction and use CDR for mysql.

Related

I am trying to get all Power BI reports while this process I sent CURL request in PHP to authenticate the user but it's throwing below error response

Please help me how to resolve this issue.
Error Response:
Array
(
[error] => invalid_grant
[error_description] => AADSTS65001: The user or administrator has not consented to use the application with ID '27ccc3c6-6560-461c-bf42-c0f3f756fa7a' named 'DrCloudEHR - East'. Send an interactive authorization request for this user and resource.
Trace ID: c137e449-e653-43d8-88f8-9abb8499b100
Correlation ID: 0b2f5c0d-ac09-49bc-81f3-b8b95a185186
Timestamp: 2020-11-20 06:10:03Z
[error_codes] => Array
(
[0] => 65001
)
[timestamp] => 2020-11-20 06:10:03Z
[trace_id] => c137e449-e653-43d8-88f8-9abb8499b100
[correlation_id] => 0b2f5c0d-ac09-49bc-81f3-b8b95a185186
[suberror] => consent_required
)
CURL REQUEST code:
$curlPostToken = curl_init();
curl_setopt_array($curlPostToken, array(
CURLOPT_URL => "https://login.windows.net/common/oauth2/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => array(
grant_type => 'password',
scope => 'openid',
prompt => 'admin_consent',
client_secret => '~-8gGXjt~Ag7_o_N0~l9.K63Iza_FA49TR',
resource => 'https://analysis.windows.net/powerbi/api',
client_id => '27ccc3c6-6560-461c-bf42-c0f3f756fa7a', // Registered App ApplicationID
username => '*********g#*******.com', // for example john.doe#yourdomain.com
password => '**********' // Azure password for above user
)
));
$tokenResponse = curl_exec($curlPostToken);
$tokenError = curl_error($curlPostToken); print_r($tokenError);
curl_close($curlPostToken);
$tokenResult = json_decode($tokenResponse, true);
print_r($tokenResult); exit;

Modifying a column with the 'Identity' pattern is not supported. Column: 'ID'. Table: 'CodeFirstDatabaseSchema.BidTo'

Up until this morning this problem did not exist. Now, however, when I try to insert into a table with an identity field that is not the primary key I get the above error.
Configuration:
public BidToConfiguration()
{
ToTable("BidTo");
HasKey(bt => new { bt.BidRecipientCode, bt.ProposalNumber });
Property(bt => bt.Awarded)
.IsOptional();
Property(bt => bt.BidRecipientCode)
.IsRequired()
.HasMaxLength(10);
Property(bt => bt.BidValue)
.IsRequired();
Property(bt => bt.ContactEmail)
.IsOptional()
.HasMaxLength(150);
Property(bt => bt.ContactName)
.IsOptional()
.HasMaxLength(150);
Property(bt => bt.ContactPhone)
.IsOptional()
.HasMaxLength(25);
Property(bt => bt.ID)
.IsRequired()
.HasDatabaseGeneratedOption(System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption.Identity);
Property(bt => bt.LastChanged)
.IsRequired();
Property(bt => bt.LastChangedBy)
.IsRequired()
.HasMaxLength(50);
Property(bt => bt.ProposalNumber)
.IsRequired()
.HasMaxLength(15);
Property(bt => bt.ReqForBidNumber)
.IsOptional()
.HasMaxLength(50);
HasRequired(bt => bt.BidRecipient)
.WithMany(br => br.BidTos)
.HasForeignKey(bt => bt.BidRecipientCode);
}
Insert into this table:
BidTo newBidTo = new BidTo();
newBidTo.Awarded = bt.Awarded;
newBidTo.BidRecipientCode = bt.BidRecipientCode;
newBidTo.BidValue = bt.BidValue;
newBidTo.ContactEmail = bt.ContactEmail;
newBidTo.ContactName = bt.ContactName;
newBidTo.ContactPhone = bt.ContactPhone;
newBidTo.ID = bt.ID;
newBidTo.LastChanged = DateTime.Now;
newBidTo.LastChangedBy = User.Identity.Name;
newBidTo.ProposalNumber = proposal.ProposalNumber;
newBidTo.ReqForBidNumber = bt.ReqForBidNumber;
_dbpm.BidTos.Add(newBidTo);
When I execute the context.SaveChanges() I get the error regardless if I have the line "newBidTo.ID = bt.ID;" commented out or not.
ADDED: One note, this table, but not the other two with the same error has an INSERT/UPDATE/DELETE Trigger.

Solr Solaruim Client->ping is failing

I am new to this stuff. I just inherited this olde system! I managed to get Solr running, and am trying to execute some old code that rebuilds the Solr data. The client ping is failing and I don't understand why.
Here is the code that is trying to initiate a re-index
// these are correct, now Solarium is falling over
// with a 404. pile of junk
print(SOLR_SERVER_HOSTNAME . "\n");
print(SOLR_SERVER_PORT . "\n");
print(SOLR_SERVER_CORE . "\n");
$options = array(
'adapteroptions' => array(
'host' => SOLR_SERVER_HOSTNAME,
'port' => SOLR_SERVER_PORT,
'core' => SOLR_SERVER_CORE,
'timeout' => 60
)
);
}
try {
// Ping the Solr server to check its availability
// create a new client. This seems to work
$this->client = new Solarium_Client($options);
if ($this->client) {
print("Solarium returned something \n");
print_r($this->client);
print("\n");
} else {
echo 'Solarium screwed the pooch';
}
// and create a ping whatever that means
// this also seems to work
$ping = $this->client->createPing();
if ($ping) {
print("ping creation worked \n");
print_r($ping);
} else {
print("ping creation failed \n");
}
// this always fails and terminate the
// program run
$this->client->ping($ping);
} catch (Solarium_Exception $e) {
print("exeption from ping request \n");
throw $e;
}
print("about to reset \n");
// Reset all filters and queries and process request params if requested
$this->reset($request);
}
The Solr admin screen is up. I have an empty collection1..
Here is the output from the trace I stuck in here
1/tmp/reindex.lock
15/01/18 17:38:54 [INFO] Index started
Index started
localhost
9999
collection1
Solarium returned something
Solarium_Client Object
(
[_options:protected] => Array
(
[adapter] => Solarium_Client_Adapter_Http
[adapteroptions] => Array
(
[host] => localhost
[port] => 9999
[core] => collection1
[path] => /solr/
[timeout] => 60
)
)
[_queryTypes:protected] => Array
(
[select] => Array
(
[query] => Solarium_Query_Select
[requestbuilder] => Solarium_Client_RequestBuilder_Select
[responseparser] => Solarium_Client_ResponseParser_Select
)
[update] => Array
(
[query] => Solarium_Query_Update
[requestbuilder] => Solarium_Client_RequestBuilder_Update
[responseparser] => Solarium_Client_ResponseParser_Update
)
[ping] => Array
(
[query] => Solarium_Query_Ping
[requestbuilder] => Solarium_Client_RequestBuilder_Ping
[responseparser] => Solarium_Client_ResponseParser_Ping
)
[mlt] => Array
(
[query] => Solarium_Query_MoreLikeThis
[requestbuilder] => Solarium_Client_RequestBuilder_MoreLikeThis
[responseparser] => Solarium_Client_ResponseParser_MoreLikeThis
)
[analysis-document] => Array
(
[query] => Solarium_Query_Analysis_Document
[requestbuilder] => Solarium_Client_RequestBuilder_Analysis_Document
[responseparser] => Solarium_Client_ResponseParser_Analysis_Document
)
[analysis-field] => Array
(
[query] => Solarium_Query_Analysis_Field
[requestbuilder] => Solarium_Client_RequestBuilder_Analysis_Field
[responseparser] => Solarium_Client_ResponseParser_Analysis_Field
)
[terms] => Array
(
[query] => Solarium_Query_Terms
[requestbuilder] => Solarium_Client_RequestBuilder_Terms
[responseparser] => Solarium_Client_ResponseParser_Terms
)
[suggester] => Array
(
[query] => Solarium_Query_Suggester
[requestbuilder] => Solarium_Client_RequestBuilder_Suggester
[responseparser] => Solarium_Client_ResponseParser_Suggester
)
)
[_pluginTypes:protected] => Array
(
[loadbalancer] => Solarium_Plugin_Loadbalancer
[postbigrequest] => Solarium_Plugin_PostBigRequest
[customizerequest] => Solarium_Plugin_CustomizeRequest
[parallelexecution] => Solarium_Plugin_ParallelExecution
[bufferedadd] => Solarium_Plugin_BufferedAdd
[prefetchiterator] => Solarium_Plugin_PrefetchIterator
)
[_pluginInstances:protected] => Array
(
)
[_adapter:protected] =>
[_requestBuilders:protected] =>
)
ping creation worked
Solarium_Query_Ping Object
(
[_options:protected] => Array
(
[resultclass] => Solarium_Result_Ping
[handler] => admin/ping
)
[_helper:protected] =>
[_params:protected] => Array
(
)
)
exeption from ping request
Failed to initialise Solr client:
Solr HTTP error: Not Found (404)
Failed to initialise Solr client: Solr HTTP error: Not Found (404)
Any hints? It's the first time I have seen this stuff.
Cheers,
Mark.
Fixed. The core name was getting flattened in another bit of code. Two constants for the same property. Two different values! – Addinall 22 secs

.NET Core Web Api Loading Nested Entities

I have a db model that looks like:
public CallTrackers()
{
CallTrackerCallerTelns = new HashSet<CallTrackerCallerTelns>();
CallTrackerClients = new HashSet<CallTrackerClients>();
CallTrackerFlwups = new HashSet<CallTrackerFlwups>();
CallTrackerHistory = new HashSet<CallTrackerHistory>();
}
With my GetAll() I am loading everything fine except for CallTrackerClients has 3 nested objects that I can't retrieve:
public CallTrackerClients()
{
CallTrackerClientAdvice = new HashSet<CallTrackerClientAdvice>();
CallTrackerClientOffences = new HashSet<CallTrackerClientOffences>();
CallTrackerClientSureties = new HashSet<CallTrackerClientSureties>();
}
I am trying:
[HttpGet]
public IEnumerable<CallTrackers> GetAll()
{
return _context.CallTrackers
.Include(log => log.CallTrackerClients)
.ThenInclude(c => c.CallTrackerClientAdvice)
.Include(log => log.CallTrackerCallerTelns)
.Include(log => log.CallTrackerFlwups)
.Include(log => log.CallTrackerHistory)
.ToList();
}
The above works but I need to get the Sureties and Offences as well. When I try .ThenInclude(c => c.CallTrackerClientOffences)I get some 'does not contain definition' error.
Any ideas how to get the two remaining collections that are part of CallTrackerClients?
You always have to start from the parent entity.
return _context.CallTrackers
.Include(log => log.CallTrackerClients)
.ThenInclude(c => c.CallTrackerClientAdvice)
// this
.Include(log => log.CallTrackerClients)
.ThenInclude(c => c.CallTrackerClientOffences)
// and this
.Include(log => log.CallTrackerClients)
.ThenInclude(c => c.CallTrackerClientSureties)
.Include(log => log.CallTrackerCallerTelns)
.Include(log => log.CallTrackerFlwups)
.Include(log => log.CallTrackerHistory)
.ToList();

Smarty check if items in array more than 1

I use smarty to display different code and I want to check if the array of some phrase contains more than 1 items.
I want to create a if phrase, that checks if the array contains only 1 value or more. Something like this, but of course that correct.
{if $domains|#array < 1}
How can I achieve that?
The code looks like this:
$domains
Smarty_Variable Object (3)
->value = Array (3)
0 => Array (17)
domain => "example1.com"
regperiod => "1"
dnsmanagement => "on"
emailforwarding => ""
idprotection => ""
addonsCount => 1
eppvalue => ""
fields => Array (0)
configtoshow => true
hosting => false
1 => Array (17)
domain => "example2.com"
regperiod => "1"
dnsmanagement => "on"
emailforwarding => ""
idprotection => ""
addonsCount => 1
eppvalue => ""
fields => Array (0)
configtoshow => true
hosting => false
2 => Array (17)
domain => "example3.com"
regperiod => "1"
dnsmanagement => "on"
emailforwarding => ""
idprotection => ""
addonsCount => 1
eppvalue => ""
fields => Array (0)
configtoshow => true
hosting => false
->nocache = false
You can use count (from the php function http://php.net/manual/es/function.count.php):
{if $domains|#count < 1}

Resources