My application wants to dynamically purchase new FAX numbers when the pool of serviced users exceeds a certain amount. I am able to do this programmatically from API like this (C#):
using Twilio;
using Twilio.Rest.Fax.V1;
using Twilio.Rest.Api.V2010.Account;
var incomingPhoneNumber = IncomingPhoneNumberResource.Create(
statusCallback: new Uri("https://myapp.co/api/v1/fax/twiliostatus"),
statusCallbackMethod:Twilio.Http.HttpMethod.Post,
pathAccountSid:"xxx",
phoneNumber: new Twilio.Types.PhoneNumber(numbers[i].PhoneNumber)
);
...but I don't see any mechanism for setting the value corresponding to the "A Fax Comes In" webhook (where I set method and URI) in the portal. Is there a way I can set this from the API?
thanks in advance!
It looks like the attribute you need to set is voiceReceiveMode.
IncomingPhoneNumber resource
The configuration parameter for the new phone number to receive incoming voice calls or faxes. Can be: fax or voice and defaults to voice.
Related
I'm new to working with discord bots and I was wondering if anybody knew a way to send embedded messages to specific channels. The only way I've found so far to send one is to use RespondAsync which just directly replies to whoever issues the command in the same channel. The purpose of my bot is to create automated link directories in read only channels and the command will just refresh them. Having trouble finding much Dsharpplus c# examples, and I'm terrible at making sense of documentation. Any help would be appreciated.
await ctx.RespondAsync(embed);
this is what I've been using to send my embeds for testing purposes, but like I said I'd like to send it in a way that it posts to a specified channel
You just need to get the DiscordChannel object of the channel(s) you want to send the embed. You can get the ID of the channel via right-click in Discord and "Copy ID"
DiscordChannel channel = await _client.GetChannelAsync(ID_OF_CHANNEL);
DiscordEmbedBuilder embed = new DiscordEmbedBuilder
{
Color = DiscordColor.SpringGreen,
Description = "Good to see you!",
Title = "Hello World"
};
await channel.SendMessageAsync(embed: embed);
The DiscordGuild class also has GetChannelAsync you can use.
Telegram added the feature to pin more than one message. I'm doing it like this:
var chat = botClient.GetChatAsync(chatid).Result;
pinnedmsgtxt = chat.PinnedMessage.Text;
pinnedmsg= chat.PinnedMessage;
but I can only get the last message that was pinned. Any way to get all of them? Am I missing something? I'm using https://github.com/TelegramBots/telegram.bot
Use messages.search method with inputMessagesFilterPinned filter.
Please read more here:
Pin API
Message Search API
Pinned messages filter
I am building a Xamarin Android application (API version>=23) that should call the SMS default application with a prefilled-in number and prefilled-in text.
I figure out how to send the SMS using SmsManager
SmsManager.Default.SendTextMessage("Number", null, "Text", null, null);
The above line send the SMS text directly after the user grants the permission to the app. Is there a way to open the default SMS app instead with prefilled in destination number and text, and let the user press send ?
Any help would be appreciated.
Setting up an Intent can bring up the default SMS massager app:
var intent = new Intent(Intent.ActionSendto);
intent.SetData(Android.Net.Uri.Parse("smsto:" + "555-555-1212"));
intent.PutExtra("sms_body", "StackOverflow rocks");
StartActivity(intent);
It is doubtful that there is no SMS registered app, but you can use the Intent that you populated to check for for which app/activity will launched:
var packagename = intent.ResolveActivity(PackageManager)?.PackageName;
We use Azure Notifications Hub to manage notifications registrations. Every time user launches application, we call PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync and then RegisterNativeAsync of NotificationHub to register channel uri, returned by first with some tags like "Username" and "InstallId" - that is unique per app installation. Then from back-end we send notifications using these tags.
But we have noticed problem - when user hard-resets device, the previous channel registration stays active in notification hub. In that case user receives duplicate notifications by his "Username" tag. "InstallId" doesn't help in that case, as it is changing with new app installation.
We have thought about managing channels server-side. But that will not solve the problem.
Maybe anyone has some suggested work-around?
Also, we don't know what information does PushNotificationChannelManager use when creating new or returning existing channel? Does it use some device information?
I think you can send the backend the device unique Id along with the installation Id. The device id will not change upon hard reset.
private string GetDeviceUniqueID()
{
HardwareToken token = HardwareIdentification.GetPackageSpecificToken(null);
IBuffer hardwareId = token.Id;
HashAlgorithmProvider hasher = HashAlgorithmProvider.OpenAlgorithm("MD5");
IBuffer hashed = hasher.HashData(hardwareId);
string hashedString = CryptographicBuffer.EncodeToHexString(hashed);
return hashedString;
}
In my application I want to show a real time overview of all active calls on a asterisk server.
That's why I want to get all events (channel created/destroyed etc.) from Asterisk 12 server using the Asterisk 12 REST API (ARI).
When I connect to the websocket I only get events that are somehow targeted to my application that I specified in the initial call to "/ari/events" (in this case "hello").
$ wscat.py 'ws://localhost:8088/ari/events?app=hello&api_key=...'
How can I get all events (e.g. also information about new incoming calls)?
Or is there another possibility to get the desired information?
I am using AsterNET.ARI .NET Stasis Framework and the following code:
// Create a message client to receive events on
Client = new ARIClient(
new StasisEndpoint(Host, Port, Username, Password),
AppName
);
Client.Connect();
Client.OnChannelStateChangeEvent += Client_OnChannelStateChangeEvent;
The method Client_OnChannelStateChangeEvent is only called for calls that I have originated by my application using Client.Channels.Originate(...).
You can use AMI(manager interface)
http://www.voip-info.org/wiki/view/Asterisk+manager+API
http://www.voip-info.org/wiki/view/asterisk+manager+events