×

info

Dear guests,
You are currently on the old forum we kept as a knowledge base. You will find the new community forum here
Welcome, Guest
Username: Password: Remember me
Keyword
Please report any bugs or errors here.

TOPIC: Problem call gateway with id

Problem call gateway with id 5 years 11 months ago #76488

  • Anonymous user
  • geoffc's Avatar
  • Posts: 10
  • Karma: 0
I am writing an interface to AcySMS and I am trying to call the gateway routine with an id of 1 (the test gateway) and getting the followng messages.

Warning: include_once(/share/MD0_DATA/Web/J33/administrator/components/com_acysms/gateway/$sid/gateway.php) [function.include-once]: failed to open stream: No such file or directory in /share/MD0_DATA/Web/J33/administrator/components/com_acysms/classes/senderprofile.php on line 40

Warning: include_once() [function.include]: Failed opening '/share/MD0_DATA/Web/J33/administrator/components/com_acysms/gateway/$sid/gateway.php' for inclusion (include_path='/share/MD0_DATA/Web/J33/plugins/system/shlib/shl_packages//ZendFramework-1.11.7-minimal/library:.:/etc/config/php') in /share/MD0_DATA/Web/J33/administrator/components/com_acysms/classes/senderprofile.php on line 40

Could not load the gateway : /share/MD0_DATA/Web/J33/administrator/components/com_acysms/gateway/$sid/gateway.php

If instead of the call to the gateway I use the actual name of the gateway i.e. 'test' it works correctly.

From this I conclude that the I need to pass in the gateway name rather than an id to the call:
$gateway = $senderProfileClass->getGateway('$sid'); // Needs to be name of gateway NOT id.

Is this a documentation mistake or am I doing something wrong?

One other question is that even when I send a test message using the 'test'gateway and get a status return of 1. I do not see the test message in the AcySMS message queue. I would have expected to see the message send, even though the test gateway doesn't really send the message. Is this my misunderstanding or is it expected behaviour?
Last Edit: 5 years 11 months ago by Anonymous user. Reason: typos
Please log in to post a reply

Problem call gateway with id 5 years 11 months ago #76491

  • Alexandre
  • Alexandre's Avatar
  • Posts: 2462
  • Karma: 67
Hi,

You should use this line :
$gateway = $senderProfileClass->getGateway($sid);
(I've removed the " characters which meant that you were sending the string '$sid' instead of the value of your variable)
One other question is that even when I send a test message using the 'test'gateway and get a status return of 1. I do not see the test message in the AcySMS message queue. I would have expected to see the message send, even though the test gateway doesn't really send the message. Is this my misunderstanding or is it expected behaviour?

The test messages are not sent using the queue so you won't see them in the queue neither in the statistics.
Please log in to post a reply

Problem call gateway with id 5 years 11 months ago #76494

  • Anonymous user
  • geoffc's Avatar
  • Posts: 10
  • Karma: 0
Well spotted. I must have spent half an hour looking at that!.

Re the 'test' messages, it looks like one has to assume that if there is a good status return that the message would go successfully..
I asked because if one sends a test SMS message from the AcySMS componnet itself the messages seem to be shown in the queue. Thus I was expecting something similar for an 'outside' call to the test interface.

If would be helpful if there was a debug option or something similar so that one could see that the messages were getting through to AcySMS on the test interface correctly. Do not want to send 'real' messages out whilst developing an interface.
Last Edit: 5 years 11 months ago by Anonymous user. Reason: typos
Please log in to post a reply

Problem call gateway with id 5 years 11 months ago #76528

  • Alexandre
  • Alexandre's Avatar
  • Posts: 2462
  • Karma: 67
Hi,


A simple message body can't be inserted in the queue. In order to insert a message in the queue you will need to create a message, save it in the database and then insert it into the queue. However this solution seems to be really complicated..

Could you please give me more details about the message you want to send ?
Please log in to post a reply

Problem call gateway with id 5 years 11 months ago #76536

  • Anonymous user
  • geoffc's Avatar
  • Posts: 10
  • Karma: 0
I have an application component that is user to track problems, and the desire is to make use of AcySMS to send messages to the problem creator, admin, and people working the problem with details of changes etc. This means that the message is usually going to be different every time, hence it is silly to create a specific message (in AcySMS) every time since it has a one time/limited use. I have a 'working' solution using the 'test' interface which seems to indicate that the message is send successfully, but of course since it is the 'test' interface I cannot see (or know) what AcySMS is, or has done with the message. Without using a 'real' interface to a provider such as 'Clickatell' I cannot check that all my code is working fine in all circumstances.

What I was expecting or hoping for was some form of record in AcySMS to say that message was received on such and such, and despatched (if appropriate) . Perhaps a message size and what the message was perhaps, but it seems from what you are saying that this is not possible. There appears to be no record of what the 'test' interface has or is doing, hence the desire for a 'debug' type feature for the test interface..

IF I was using 'canned' messages then I understand it would be worth keeping messages in some form of 'holding' queue so they can be reused, but that currently is not how our component works. Adrien supplied me with some sample code (similar to that in your dev docs) which I have modified It basically gets the gateway, and send a text message using a simple:
$status = $gateway->send('your message...','+34654879465');
Where my message is what ever I am sending and I supply the text and a phone number every time. I get a status return of '1' which is 'true' so I think that AcySMS has handled the message fine. Just have no way, other than the status return to know one way or the other though.

The message text would usually be something to the effect that 'such and such a change has occured on your reported problem xxxxx, and could you try 'so and so' etc. It is generated on the fly based upon the 'work' performed on the problem and could be very brief or quite verbose. At the very minimum the message would contain a 'problem number' (xxxx) which would have to be plugged into the message text. My code already generates the suitable message text and feeds it into the gateway->send method. As an example think about the implication of sending the reply to this post to me via SMS. Each time the message would be the reponse to the topic and different every time.

Using the gateway->send method is fine since usually only one or perhaps 2/3 messages would ever be sent to a specific phone number. Hence I would not normally expect to set up specific 'receivers' in AcySMS.

Does that explain it sufficiently?
Please log in to post a reply

Problem call gateway with id 5 years 11 months ago #76539

  • Alexandre
  • Alexandre's Avatar
  • Posts: 2462
  • Karma: 67
Hi,

If you use the $gateway->send function the message will be sent by AcySMS and then a result will be return.
If the result is "true" or "1" this means that the message was successfully sent to the gateway. If an error occurred the result of the send function will be "false" or "0". At this moment you will able to see what's the problem by using the $gateway->errors (array) variable.

Here is how we handle the send process :
$status = $gateway->send($message_body, $phone);
$gateway->close();
if(!$status){
	//Error while sending 
        echo implode('<br />',$gateway->errors);
}else{
	//Message successfully sent. 
        echo 'Success';
}

Using this code, you will be able to know if the SMS was successfully sent or not :)
Please log in to post a reply

Problem call gateway with id 5 years 11 months ago #76540

  • Anonymous user
  • geoffc's Avatar
  • Posts: 10
  • Karma: 0
I will try that as it will be useful when I use a 'real' interface. As I mentioned earlier, I get a status return of '1' so it is always (?) successful on the test interface. I am looking at the 'classes' at the moment so may well have additional quetions later.
Please log in to post a reply

Problem call gateway with id 5 years 11 months ago #76541

  • Alexandre
  • Alexandre's Avatar
  • Posts: 2462
  • Karma: 67
Hi,

The test gateway generates a random number between 0 and 50. If the number is 0 or 1 the gateway will return false otherwise it will return true.

You should take a look at the gateway.php file in /administrator/components/com_acysms/gateway so that you will be able to make your own tests ;)
Please log in to post a reply
Time to create page: 0.056 seconds
Powered by Kunena Forum