Support forum

Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_TopicIcon
Diafaan SMPP HTTP API User_ID issue
sp_NewPost Add Reply sp_NewTopic Add Topic
February 15, 2019
3:48 pm
Adam
Guest
Guests

Hello Henk,

So glad to let you know that the issue has been solved and web connector working perfect with the http callback and the plugin.

You guys have wonderful support especially you Henk, i appreciate all your support and your time .

We will continue the testing and we will buy the software on next week.

My best regards to you and your team

Adam

February 15, 2019
3:31 pm
Adam
Guest
Guests

Hello Henk,

I'm so happy that there is solution and updates for that , i will wait your email .

Thank you

Adam

February 15, 2019
3:29 pm
Henk Helmantel
Admin
Forum Posts: 1073
Member Since:
May 28, 2013
sp_UserOfflineSmall Offline

Thanks again. My mistake, I was testing with a development version of Diafaan SMS Server were this bug was already identified and fixed. After testing it on version 4.3.0.0 I saw the same response as you did.

I will email you a link to the modified plugin for the Web Connector and instructions on how to install it.

Regards, Henk

February 15, 2019
2:47 pm
Adam
Guest
Guests

Hi henk,

I have sent you the Log file please check

Thank you

February 15, 2019
2:36 pm
Henk Helmantel
Admin
Forum Posts: 1073
Member Since:
May 28, 2013
sp_UserOfflineSmall Offline

Thank you for the configuration file.

Strange, with the settings for the Web Connector in your configuration file, the user_id parameter in the message_out HTTP callback should be set to the username in the request of the HTTP API. This is also what I see in my test with this configuration.

I would also like to see the communication log for the Web Connector with at least one send_message HTTP API request to see in what way it is different from my own test.

Regards, Henk

February 15, 2019
2:10 pm
Adam
Guest
Guests

Hello Henk,

I have sent you the email , please check for the same.

Regards
Adam

February 15, 2019
1:45 pm
Henk Helmantel
Admin
Forum Posts: 1073
Member Since:
May 28, 2013
sp_UserOfflineSmall Offline

Can you send the configuration file of Diafaan SMS Server (menu options 'File-Export-Configuration) to email address dms@diafaan.com so that I can do some tests with your configuration?

Regards, Henk

February 15, 2019
10:54 am
Adam
Guest
Guests

Hello Henk,

I have tried to understand your solution, and do many trials to change the parameters and the configurations of the system, and keep referring to your documentations. However, I am still facing the same difficulties.

Please do advice us how to override the User_id to become the same value of the username parameter in the HTTP API. We want to use the HTTP Callback for account balance control of the end-customer. If there is no use for HTTP callback, then it will be useless to be a built-in function in the software.

Please give us step-by-step how to the solve issue (if possible with figures).
We are in an urgent need for SMPP solution, please consider to give us the simplified solution to our issue to buy your full-edition software.

Thanks,
Adam.

February 15, 2019
10:24 am
Henk Helmantel
Admin
Forum Posts: 1073
Member Since:
May 28, 2013
sp_UserOfflineSmall Offline

I am sorry I did not explain it very well.

If you use the option 'Use HTTP callbacks for user verification' option in the 'HTTP server' options of the Web Connector it should work as you expect. The user_id is then set to the username parameter in the send_message HTTP call.

If the 'Use HTTP callbacks for user verification' option is not enabled, the user_id will not be set to the username parameter but to a numeric value that corresponds to a user.

Please let me know if it is still not entirely clear.

Regards, Henk

February 15, 2019
9:24 am
Adam
Guest
Guests

Hello Henk,

I'm not clear with your solution , do you mean that i should only use the validate user option to do the verification and then do the accounting there ?, so we just avoid using the message-out query to solve the issue ?

Actually what we did so far is we have add the message-out code to do the credits accounting inside the validate user page and its working fine.

So do let me know if your solution same to mine or if you mean another way please explain it more , and here is the edited code for the validate user page which we made :

setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );

// Check if a user with user_id and password exists
$sqlStatement = $sqlConnection->prepare('SELECT ip_number FROM users WHERE user_id = :user_id AND password = :password');
$sqlStatement->bindParam(':user_id', $user_id);
$sqlStatement->bindParam(':password', $password);
$sqlStatement->execute();
if ($result = $sqlStatement->fetch(PDO::FETCH_ASSOC)) {
// We found the user, check if the ip_number is valid
if (($result['ip_number'] === '') || ($result['ip_number'] === $ip_number)) {
// $response = 'result=1';

// Get the number of credits left for the user
$sqlStatement = $sqlConnection->prepare('SELECT credits FROM users WHERE user_id = :user_id FOR UPDATE');
$sqlStatement->setFetchMode(PDO::FETCH_ASSOC);
$sqlStatement->bindParam(':user_id', $user_id);
$sqlStatement->execute();
$credits = 0;
if ($row = $sqlStatement->fetch()) {
$credits = $row['credits'];
}

// Calculate the number of credits required for this message
$messageParts = GetMessagePartCount($message, $message_type);
// If the user has sufficient credits left, accept the message. Otherwise reject it.
if ($credits >= $messageParts) {
$credits -= $messageParts;
$response = 'result=1';

// Update the database with the new credit value
$sqlStatement = $sqlConnection->prepare('UPDATE users SET credits = :credits WHERE user_id = :user_id');
$sqlStatement->bindParam(':credits', $credits);
$sqlStatement->bindParam(':user_id', $user_id);
$sqlStatement->execute();
}
else {
// Insufficient credits, generate SMPP error 69 (submit_sm failed);
$response = 'result=0&error_code=69';
}
}
else {
$response = 'result=0&result_error_text='.urlencode('Invalid ip_number \''.$ip_number.'\'.');
}
}
$sqlConnection = null;
}
catch(PDOException $e) {
$response = 'result=0&result_error_text='.urlencode('MySQL PDO error: '.$e->getMessage());
}

echo $response;
exit;
?>

February 15, 2019
8:44 am
Henk Helmantel
Admin
Forum Posts: 1073
Member Since:
May 28, 2013
sp_UserOfflineSmall Offline

Hello Adam,

The latest version of Diafaan SMS Server has a bug that causes the user_id parameter to be set to a wrong value. We will fix that in the next version but this won't solve your issue because after the bug fix the user_id will be set to a numerical id of the user instead of the name. The Web Connector uses the user_id parameter internally so it is not easy to change this.

To solve this issue you might consider using the Validate user HTTP callback to validate the user/password combination instead of the internal user database of the Web Connector. When you use this option to validate the username/password, the user_id parameter will be set to the user name instead of an internal numeric user id and you can use this in subsequent HTTP callbacks.

Regards, Henk

February 15, 2019
5:43 am
Adam
Guest
Guests

Hello Team,

We have doing the testing for your SMPP software so far everything good , but when we are using the HTTP API together with the HTTP Call Back, the user_id coming different from the username value which we used in the HTTP API , bellow you can see the issue from the log file

2019/02/14 04:19:11.967 127.0.0.1 ERROR:311 Message rejected

So the username is : admin but once we hit the the HTTP API the username become as like this : user_id=6ea52b68-f555-43ac-b12e-916454104b33 , so because of this the code in message_out.php not working as it can't match the user_id with the one inside MYSQL DB.

At the same time we have hard coded the user_id inside the message_out.php and its working and we can send the SMS .

Please advise in order to finished the testing and buy the full version one.

Forum Timezone: Europe/Amsterdam

Most Users Ever Online: 494

Currently Online:
8 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Member Stats:

Guest Posters: 546

Members: 0

Moderators: 0

Admins: 1

Forum Stats:

Groups: 2

Forums: 3

Topics: 872

Posts: 3001

Newest Members:

, Henk Helmantel

Administrators: Henk Helmantel: 1073