I want to create a simple USSD Menu Browser Application in Java. I have integrated with
one of the Mobile operator to get the USSD Platform. And i have successfully implemented &
tested USSR message pushing. But not able to get started with USSN (Menu Browser) in java. So please help me how to get started with simple USSD menu browser application.
You can use a modem with AT commands.
You need 3GPP TS 27.007 (search in google for latest version), command called CUSD.
Send something like this AT+CUSD=1,AA180C3602,15 which means
1 - I want to read result,
AA180C3602 - *100# (GSM 7bit)
(http://engnick.blogspot.com/2011/09/gsm-7bit-part-of-pdu-packencoding.html),
15 - encoding type particular to PDU.
You'll will receive as a response like this:
+CUSD: 0,"00390030002C003000320020044004430431002E002004210443043F043504400410041E041D0020043E043F0440043504340435043B043804420020043D043E043C04350440043000200437043000200033002C00350440002F043400210020002A0035003000320023",72
, where
0 - ok,
"..." - text in UTF-16 and
72 - encoding type.
If your response requires an answer (menu mode), you will see 1 instead of 0 in first parameter. Just send expected number and you'll support this session (AT+CUSD=1,31,15 - for sending a number 1).
Related
So I am a total newbie in asterisk and managing call lines in general but I managed to install Asterisk Now 13 distro, I have connected 2 sip phones with pjsip and configured a sip trunk which works when I dial an external number with the corresponding prefix. Now I have to programmaticly originate calls and connect them to local extensions which I have no idea how to achieve and I cant seem to find much information about it on the internet after hours of searching.
I managed to connect 2 local sip phones with the asterisk manager api and OriginateAction in the following way:
originateAction = new OriginateAction();
originateAction.setChannel(ConnectionType+"/"+extCaller);
originateAction.setContext(context);
originateAction.setCallerId(idCaller);
originateAction.setExten(tDestination);
originateAction.setPriority(priority);
originateAction.setTimeout(timeoutCall);
managerConnection.login();
originateResponse = managerConnection.sendAction(originateAction, timeoutRequest);
I also tried this channel originate pjsip/201 extension number#from-ptsn and channel originate local/201#from-local extension number#trunkName .
The context of the PJSIP trunk is from-pstn,I tried using that in various ways without luck both in asterisk cli and the application.
How do I make it use the PJSIP trunk when originating the call and make a call out of the office?
EDIT: I originated an outgoing call using a number that completes with the trunk outgoing route requisites and the "from-internal" context like this:
channel originate Local/201#from-internal extension (prefix)numberToCall#from-internal
I still do not understand why this works and if it is the correct answer to my question.
So the answer is in the edit of the question. The only way to generate an outgoing call that I could find is to originate that call "internaly" (with the context "from-internal" which happens to be the same context that is used when originating internal calls) introducing a target number value that completes with the sip trunk's route pattern requirements.
Example:
I have a route configured for the sip trunk( trunk1 ) with a pattern(RegEx): [0]{1}/number/ that means that with a 0 infront of any nubmer it will be a valid value for that route and it will try to call using trunk1.
In the case of AsteriskNow CentOS installation it happens to be with the context "from-internal". Since the asterisk configuration files are owned by the FreePBX it is recomended to use the FreePBX GUI instead of configuring the .conf files of asterisk manualy.
That concludes to :
channel originate Local/201#from-internal extension (0)[numberToCall]#from-internal
Which will make the extension 201 ring first and when picked up it will try to use the sip trunk to dial that [numberToCall] because the route with the 0 is "called".
In order to send that command to asterisk using asterisk-java I wrote the following code:
ManagerConnectionFactory factory = new
ManagerConnectionFactory("serverIp", "username",
"passwd");
ManagerConnection managerConnection=factory.createManagerConnection()
OriginateAction originateAction=new OriginateAction();
final String randomUUID=java.util.UUID.randomUUID().toString();
System.out.println("ID random:_"+randomUUID);
originateAction.setChannel([connectionType]+"/"+[callerExtension]);<-- SIP or PJSIP / 201(the phone that will ring first)
originateAction.setContext("from-internal"); <-- Default FreePBX context
originateAction.setCallerId([callerId]); // what will be showed on the phone screen (in most cases your phone)
originateAction.setExten([targetExten]); //where to call.. the target extension... internal extension or the outgoing number.. the 0[nomberToCall]
originateAction.setPriority([priority]);// priority of the call
originateAction.setTimeout(timeoutCall); // the time that a pickup event will be waited for
originateAction.setVariable("UUID", randomUUID); // asigning a unique ID in order to be able to hangup the call.
I'm currently working with an Android payment application using NFC.For this purpose Android application need to send and receive APDU commands to ISO/IEC 14443-4 Smart Card.
When i test my application using Galaxy S5(OS 4.4.2) , or Galaxy s3(OS 4.1.2) I'm getting 6A82
My Code flow is going like below:
1st step ->
Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
IsoDep iso = IsoDep.get(tag);
iso.connect();
2nd step ->
By using iso.transceive()..
I'm sending APDU command 0084000008 from Mobile Application to Smard Card and
receiving F5BC9C9F3A2B7C179000 as response.
3rd Step ->
using iso.isConnect() I'm checking the connection and
-> Connection available
4th Step ->
By using iso.transceive()..
sending APDU command : 903203000A1403CF549C2B7520389C
receiving : 6A82 All the time
I would be happy if anyone suggest me why I'm getting strange File not found (6A82) for this APDU command.
after calling iso.connect() you should send select apdu first
00A40400 +
for example :
(u should convert hex to bytes first)
aid = AABBCCDD;
byte[] selectCmd = 00A4040004AABBCCDD
isoDep.transceive(command)
I'll first say that I'm sure it is just me since people have probably got this to work out of the box without having to edit the ADAL 4 Android Library without editing the source.
When running the sample program and authenticating with a token I get an error from AZURE that it is not passing the client_secret in the message body. I can confirm that this is in fact the case - it is not passing the client_secret.
Although if I edit the OAuth2.java file and change the method buildTokenRequestMessage to something like the following the workflow works perfectly
public String buildTokenRequestMessage(String code) throws UnsupportedEncodingException {
String message = String.format("%s=%s&%s=%s&%s=%s&%s=%s&%s=%s",
AuthenticationConstants.OAuth2.GRANT_TYPE,
StringExtensions.URLFormEncode(AuthenticationConstants.OAuth2.AUTHORIZATION_CODE),
AuthenticationConstants.OAuth2.CODE, StringExtensions.URLFormEncode(code),
AuthenticationConstants.OAuth2.CLIENT_ID,
StringExtensions.URLFormEncode(mRequest.getClientId()),
AuthenticationConstants.OAuth2.REDIRECT_URI,
StringExtensions.URLFormEncode(mRequest.getRedirectUri())
// these are the two lines I've added to make it work
AuthenticationConstants.OAuth2.CLIENT_SECRET,
StringExtensions.URLFormEncode("<MY CLIENT SECRET>")
);
return message;
}
Am I doing something wrong? If not, what is the correct way to access the client secret?
My implementation is straight from the demo application with only changes being setting up the strings to match my endpoints.
Thanks
You need to register your app as a Native application at Azure AD portal. You don't need client secret for native app.
I am in need to somehow display image on Linux console. Why am I need it?
I need to manually enter CAPTCHA code. However my application runs on remote linux system and I am connecting to it via SSH (Bitwise client). I have thought about writing directly to screen, but hey - I see only "clone" of terminal not the remote terminal itself so this is impossible to achieve. Maybe some kind of Img2Asci converter? Please advise.
You want to forward your X session.
on the remote system make sure xauth is installed.
on the client system make sure an X client is installed (Xming for windows)
Connect with ssh -X from a command line or with putty enable X forwarding.
You can then either use display filename or most applications that so that sort of thing will pop up if a display is detected
Assuming you can't forward your X session, perhaps something like jp2a, which converts JPEG to ASCII ?
convert http://www.google.com/intl/en/images/logo.gif jpg:- | jp2a -
....... .':.
.::'....':xd. dX'
.ld. .. . oX. ...
;O' .c;..'cxc ;,...,c;. .:'.,lxc. dX. ,:'.,dx.. .
oO. .ox. ,x0 .cd. .cd..ll l0. xX. :K,..,::.
cxx. .',cl 'x0 lK'.cx ;k, lO; .ll. dX. o0:
,dkc. :kd :kx. :d; ,ol. .lc. .''lk' kX' oOo'...
.;:cc;,,',,. .;;,'.. .,,'... ''',:lxo. .','. .,::;.
.oc. dO
lk;....'c'
.'....
my question is how to push data from server in atmosphere without using javaScript
I followed the chat tutorial it was so understandable, now I want to push data from an action in struts 2 (and not from javascript) i know that I must call .onMessage() method but I'm blocked on how to build AtmosphereResponse argument I tried
AtmosphereResponse response = new AtmosphereResponse.Builder().build();
but it return NullPointerExeption when I use response.write() methode
thanks a lot for your collaboration
Solution : BroadcasterFactory.getDefault().lookup("/atmosphere").broadcast(message);
"/atmosphere" is your AtmosphereServlet pattern