I'm having some hard times with twilio conference.
I connect from web browser using js client v1.3
conn = Twilio.Device.connect(params);
I want to create a new conference and allow this web user to hangup by pressing * and then add another person on the call by entering 10digits followed by #.
Here is python code that generates Twiml for this connect:
resp.dial(hangupOnStar=True).conference(conf_name, waitUrl='http://twimlets.com/holdmusic?Bucket=com.twilio.music.soft-rock')
resp.say("Please enter 10 digit phone number followed by # to add someone to this call. "
resp.gather(action="example.com/add_participant/", numDigits=10, finishOnKey='#', timeout=30)
Here is a sample Twiml:
<?xml version="1.0" encoding="UTF-8"?><Response><Dial hangupOnStar="true"><Conference waitUrl="http://twimlets.com/holdmusic?Bucket=com.twilio.music.soft-rock">room1</Conference></Dial><Say>Please enter 10 digit phone number followed by # to add someone to this call. Press any key followed by # if you want to be placed back to the call!</Say><Gather action="http://example.com/add_participant/room1/" finishOnKey="#" numDigits="10" timeout="30" /></Response>
After connection is opened, in web browser I try to send dtmf code for * that would execute SAY and GATHER verb.
For this I tried:
1. conn.sendDigits('*');
2. c = Twilio.Device.activeConnection();
c.sendDigits('*');
But I connection does not hangup and thus it does not get me to SAY and GATHER verbs.
Same Twiml works good if I call in from a cell phone and send dtmf code from cell keypad. Users hangs up and SAY + GATHER flow follows as expected.
Also, if there is a second party connected to this conference, and I call sendDigits('*') I can here dtmf code on the other end of the call, it just won't trigger tha hangup.
Is there something about the JS client that I'm missing?
Thank you!
Related
I have a page with html , so in my case i would to have a softkey button or slider which can function as ON & OFF ( in Single button ) main function for this button is to disable my WwanSvc whenever it is slided to OFF and to enable WwanSvc whenever i slide back to ON , so i'm looking for a help here that someone could provide good example.
Seriously i dont know anything about this since i'm a technical guy
#echo off
sc query "WwanSvc" | find "RUNNING"
IF %ERRORLEVEL% == 0 GOTO DISABLE
sc start "WwanSvc"
msg %username% DiGi Connected
TIMEOUT 1
EXIT
:DISABLE
sc stop "WwanSvc"
msg %username% DiGi Disconnected
TIMEOUT 1
EXI
This codes i'm using for a batch file but since a batch file cant show the state so i'm looking for a change to slider which can show ON or OFF
JavaScript is client-side only language and cannot affect the system it runs on for security reasons.
Normally one would write a daemon/service in a server-side language and your Javascript app will send commands to that service which has access to affect the system.
sns = boto3.client('sns')
sns.publish(
PhoneNumber = '+11234567890',
Message = 'Simple text message'
)
Here's a example code to send a text to given number. But I want to have a time interval between two continuous send by same user. I know that button could be implemented in JavaScript. But it's not secure enough because user could change script in client side and remove this restriction.
Is there any other solution with given API of SNS or I have to create extra cost in Database to store timestamp for given user?
The sns.publish command is immediate. If you wish to delay sending, you would need to code a solution that waits before sending the request.
You could do this by triggering AWS Step Functions with a wait step, and then calling an AWS Lambda function to do the actual send. It's starting to make things rather complex.
Normally, if you have a web page calling an AWS function, it is preferable to put the logic on the back-end so that users cannot call AWS directly. Rather, the page triggers some code in AWS (eg Lambda via API Gateway, or a request to a REST application) and it performs the authentication and logic.
I have read almost everything there is on the Internet (almost no examples) and studied the (very limited and confusing) documentation.
I have a client were I am integrating payone, and I am not getting any further.
So I used the API client documentation and integrated the iframe client api example with creditcardcheck on page 35 (chapter 3.1.5.5). This works fine I receive the answer and a pseudocardpan.
As explained in the quick start guide, I then start the "preauthorization", using the server api with the pseudocardpan. I send all the necessary parameters again, and I end up on the server payone with status = approved .
I assume this is then successfull. However, what or how should I proceed? What is the transactionUrl for? Maybe someone has experience with payone.
sorry to hear you're having a tough time implementing a Payone interface. We are currently working on providing more insightful examples. Please bear with us for a little longer.
Meanwhile, I'll gladly help you with continuing your integration. After the successful preauthorization, you'll need to store the txid for further reference to this transaction. To collect the money from the creditcard, you'll need to send a capture request with the amount you wish to collect and the txid as a reference (see the docs for a full list of required parameters).
If you don't want to send a capture request afterwards (for instance if you want to collect the entire amount immediately after the customer completed their order) you can send an authorization request instead of the preauthorization and leave out the capture part.
The transaction status URL is used to asynchronously inform your application about status changes in Payone transactions. For instance in a prepayment setting we'll send a PAID notification as soon as the customer paid the amount to your bank account.
Best,
Florian (Technical Partner Manager # Payone)
I understand that once the response comes back that it has been approved, then it is approved - all the details were correct and authorisation was successful.
If you are doing a preauthorization then you will need to follow that with a capture to actually take the payment. In some legislative environments, for example many US states, you cannot capture the payment until you finally ship the goods from an online shop.
If that is not a problem (e.g. paying invoices, running an online shop in the UK), then use authorization, which does a preauthorization and capture all in one step. Apart from the name of the request, the details of the message you send is identical.
I am stack to finding a filter or any way to find a phone number from string. Actually I get a response in string and there is a phone number too and client want to make link because of smart-phone when user tab on it. it's goes to call directory.
here is client request to do with response.
"Low priority but could we make it so that the phone number is a hyper link so the user can press and it goes to make call.
I.e.
0035312998080
Or
+35312998080"
here is a test response.
Unable to process this booking online it is too close to the party date. To book please phone Fun Fitness - Play Centre on 353 - 1 - 2998080
Why do you need to find it? It's right there...
To make it callable:
555-555-1212
Stolen from How to create hyperlink to call phone number on mobile devices?
On my website, I have built a chatroom with support for multiple rooms. When a user joins the room, a session is placed into the database so that if they try to join the room again in another browser window, they are locked out.
It works like this
1. Join the chatroom page
2. Connect to chatroom #main
If the user has a session in the database for #main
--- Block user from joining
else
--- Load chatroom
When the chatroom is closed client side or the user terminates there connection with the /quit command, all of their sessions are deleted, and this works fine.
However
There is a possibility that users will just close the browser window rather than terminating their connection. The problem with this is that their session will stay in the database, meaning when they try to connect to the room, they are blocked.
I'm using this code onbeforeunload to try and prevent that
function disconnect() {
$.ajax({
url: "/remove-chat-sessions.php?global",
async: false
});
};
This is also the function called when the user types the /quit command
The problem
The problem with this is that when I reload the page, 5 times out of 10 the sessions have not been taken out of the database, as if the ajax request failed or the page reloaded before it could finish. This means that when I go back into the chatroom, the database still thinks that I am connected, and blocks me from entering the chatroom
Is there a better way to make sure that this AJAX call will load and if not, is there a better alternative than storing user sessions in an online database?
Edit:
The reason users are blocked from joining rooms more than once is because messages you post do not appear to you when the chatroom updates for new messages. They are appended to the chatroom box when you post them. This means that if users could be in the same chatroom over multiple windows, they would not be able to see the comments that they posted across all of the windows.
In this situation you could add some sort of polling. Basically, you request with javascript a page every X time. That page adds the user session to the database. Then there's a script executing every Y time, where Y > X, that cleans old sessions.
The script that is called every X time
...
// DB call (do as you like)
$All = fetch_all_recent();
foreach ($All as $Session)
{
if ($Session['time'] < time() - $y)
{
delete_session($Session['id']);
}
}
The script that javascript is calling every X time
...
delete_old_session($User->id);
add_user_session($User->id, $Chat->id, time());
The main disadvantage of this method is the increment in requests, something Apache is not so used to (for large request number). There are two non-exclusive alternatives for this, which involve access to the server, are:
Use nginx server. I have no experience in this but I've read it supports many more connections than Apache.
Use some modern form of persistent connection, like socket.io. However, it uses node.js, which can be good or bad, depending on your business.