Conference Mapper API

Hello Everyone

Hope you all are well and safe.

As i have gone through the community but didn’t find proper answer for below

We are using the https://jitsi-api.jitsi.net/conferenceMapper?id=$1 to get the conference name. Is it possible for us to host this API on our server rather than using jitsi-api.jitsi.net if yes how we can achieve it and what programming language is need to develop that service on our server.

I have gone through this https://github.com/jitsi/jitsi-meet/blob/master/doc/cloud-api.swagger
but didn’t make anything of it.

Any help will be highly appreciated.

Thanks

3 Likes

@damencho I would also like more details around self hosting the API if possible. Thanks :slight_smile:

Update:

I did a little TLS Wiresharking and found that the browser initiating a meeting completes a handshake with jitsi-api.jitsi.net and then sends an HTTP header as shown below (where “meet.domain.com” is my jitsi FQDN). This is nothing done by the jitsi server like I would have guessed.

https://jitsi-api.jitsi.net/conferenceMapper?conference=newmeeting1234@conference.meet.domain.com

The conference is then provided a 10-digit PIN in return, no doubt stored on the API server for when a user’s IVR Curls the PIN to retrieve the conference room name.

In theory , we should be able to self-host a php script that would look at a log file and randomly assign an available 10 digit number, then catalog that with the room name.

Then update config.js > dialInConfCodeUrl with our new php location.

I know very little php, but I’ll play with this as I find time. If anyone has a possible solution in mind, I’m open to collaborating :slight_smile:

1 Like

Hello @Craig_Eustice

I am also planning the same with custom php api. But the concern over here is the phone pin and conference name need to store in database on conference start and same can by retrieve via php api by sending the phone pin in request.

I am stuck at the way how I should store the pin and conference name in database.

1 Like

I finally had a little time to experiment today and found a very easy process, much simpler that I thought it would be.

  1. mysql database with 2 fields. ‘id’ (integer , auto increment, & PK) and ‘conference’ (varchar)
  2. host php file to query and insert to the database.
    • if conference already exists in the database, return matched conference and id
    • if conference doesn’t exist , then insert conference to the database. Mysql will assign the id, then php returns matched conference and id
  3. Updated config.js > dialInConfCodeUrl with my new php location (hosted on the jitsi server)
  4. Updated my asterisk IVR to curl the new php location

This is working well and amazingly simple. I’m even using 6 digit pins instead of 10 like jitsi uses and no issues.

2 Likes

Which means you are by passing the Phone PIN generated by system ? Using your own pin to get the conference name from the host php defined in dialInConfCodeUrl.

Great it should work.

Correct, PIN generated by mysql.

I’m going to document my setup soon, but here is the rough draft of my php. Let me know if you have any suggestions or feedback.

<?php
header('Content-Type: application/json');
//header("Content-Type: text/plain");
$conference = $_REQUEST['conference'];
$id = $_REQUEST['id'];
//echo "Message received, conference is $conference\r\n";


$db_host = 'localhost';
$db_username = 'MYSQL_User_name_here';
$db_password = 'MYSQL_password_here';
$db_name = 'MYSQL_DB_here';
$db_table = 'MYSQL_Table_here';


// Create connection
$conn = new mysqli($db_host, $db_username, $db_password, $db_name);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}


if ($id > 0) {

$sql = "SELECT id, conference FROM $db_table WHERE id='$id'";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
  // output data of each row
  while($row = $result->fetch_assoc()) {
     echo "{\"message\":\"Successfully retrieved conference mapping\",\"id\":" . $row["id"]. ",\"conference\":\"" . $row["conference"]."\"}";

  }
} else {
  echo "0 results";
}

} else {

$sql = "SELECT id, conference FROM $db_table WHERE conference='$conference'";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
  while($row = $result->fetch_assoc()) {
 echo "{\"message\":\"Successfully retrieved conference mapping\",\"id\":" . $row["id"]. ",\"conference\":\"" . $row["conference"]."\"}";

}
} else {

if ($conference == NULL) { 
echo "FALSE";
} else {

$sql = "INSERT INTO $db_table (conference)
VALUES ('$conference')";

if ($conn->query($sql) === TRUE) {
// begin
$sql = "SELECT id, conference FROM $db_table WHERE conference='$conference'";
$result = $conn->query($sql);
while($row = $result->fetch_assoc()) {
 echo "{\"message\":\"Successfully retrieved conference mapping\",\"id\":" . $row["id"]. ",\"conference\":\"" . $row["conference"]."\"}";
}


} else {
    echo "Error: " . $sql . "<br>" . $conn->error;
}
}
}
}
$conn->close();

?>
1 Like

Yes @Craig_Eustice that’s the same way I was able to achieve.

Basically we are using the API’s to create the conference at that time I am inserting the PIN and conference name in table. Same can be retrieve by dialinconfurl which shows my pin on interface.

Then in Freeswitch I am using the dtmf passed by caller to call the curl request to get the conference name and that we are sending in sip header to work.

It’s working well and was able to use without conference mapper of Jitsi.

Thank you for your valuable input.

1 Like

For anyone interested, I documented my approach here:

Tutorial - Self hosted Conference Mapper API