diff --git a/MySQL_conf_pbx/test1/Rest-API-Postman/CezenPBX_API.postman_collection.json b/MySQL_conf_pbx/test1/Rest-API-Postman/CezenPBX_API.postman_collection.json index 67e26b2..11e085e 100644 --- a/MySQL_conf_pbx/test1/Rest-API-Postman/CezenPBX_API.postman_collection.json +++ b/MySQL_conf_pbx/test1/Rest-API-Postman/CezenPBX_API.postman_collection.json @@ -13,7 +13,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n \"id\": \"1005\",\n \"transport\": \"transport-udp\",\n \"aors\": \"1005\",\n \"auth\": \"1005\",\n \"context\": \"default\",\n \"disallow\": \"all\",\n \"allow\": \"ulaw,alaw\",\n \"directMedia\": \"no\",\n \"connectedLineMethod\": \"invite\",\n \"callerid\": \"User <1005>\",\n \"dtmfMode\": \"rfc4733\",\n \"mohsuggest\": \"default\",\n \"mailboxes\": \"1005@default\"\n}\n\n// {\n// \"id\": \"1004\",\n// \"transport\": \"transport-udp\",\n// \"aors\": \"1004\",\n// \"auth\": \"1004\",\n// \"context\": \"default\",\n// \"disallow\": \"all\",\n// \"allow\": \"ulaw,alaw\",\n// \"directMedia\": \"no\",\n// \"connectedLineMethod\": null,\n// \"callerid\": \"User <1004>\",\n// \"dtmfMode\": null,\n// \"mohsuggest\": \"default\",\n// \"mailboxes\": \"1004@default\"\n// }", + "raw": "{\n \"id\": \"1005\",\n \"transport\": \"transport-udp\",\n \"aors\": \"1005\",\n \"auth\": \"1005\",\n \"context\": \"default\",\n \"disallow\": \"all\",\n \"allow\": \"ulaw,alaw\",\n \"directMedia\": \"no\",\n \"connectedLineMethod\": null,\n \"callerid\": null,\n \"dtmfMode\": null,\n \"mohsuggest\": \"default\",\n \"mailboxes\": null\n}\n\n// {\n// \"id\": \"1004\",\n// \"transport\": \"transport-udp\",\n// \"aors\": \"1004\",\n// \"auth\": \"1004\",\n// \"context\": \"default\",\n// \"disallow\": \"all\",\n// \"allow\": \"ulaw,alaw\",\n// \"directMedia\": \"no\",\n// \"connectedLineMethod\": null,\n// \"callerid\": \"User <1004>\",\n// \"dtmfMode\": null,\n// \"mohsuggest\": \"default\",\n// \"mailboxes\": \"1004@default\"\n// }", "options": { "raw": { "language": "json" @@ -42,7 +42,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n \"context\": \"default\",\n \"extension\": \"1005\",\n \"priority\": 2,\n \"app\": \"Dial\",\n \"appdata\": \"PJSIP/1005,20,m(default)\"\n}\n", + "raw": "{\n \"context\": \"default\",\n \"extension\": \"1005\",\n \"priority\": 1,\n \"app\": \"Dial\",\n \"appdata\": \"PJSIP/1005,20,m(default)\"\n}\n", "options": { "raw": { "language": "json" @@ -92,6 +92,35 @@ } }, "response": [] + }, + { + "name": "New Request", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"id\": \"1005\",\n \"maxContacts\": 1\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:8081/cezen/set_aors", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "8081", + "path": [ + "cezen", + "set_aors" + ] + } + }, + "response": [] } ] } \ No newline at end of file diff --git a/MySQL_conf_pbx/test1/db_asterisk/sping_db.sql b/MySQL_conf_pbx/test1/db_asterisk/sping_db.sql index 0c99792..67a2ae1 100644 --- a/MySQL_conf_pbx/test1/db_asterisk/sping_db.sql +++ b/MySQL_conf_pbx/test1/db_asterisk/sping_db.sql @@ -27,6 +27,7 @@ DELETE FROM `extensions_table` WHERE priority = 4 and exten = "1005" ; DELETE FROM `extensions_table` WHERE exten = "1005" OR exten = "1004"; DELETE FROM `ps_endpoints` WHERE id = "1004" OR id = "1005"; +DELETE FROM `extensions_table` WHERE exten = "1004" OR exten = "1005"; SELECT * FROM `extensions_table` WHERE app = "Dial"; diff --git a/MySQL_conf_pbx/test1/mariadb_data/aria_log.00000001 b/MySQL_conf_pbx/test1/mariadb_data/aria_log.00000001 index 4fa9f8f..53eebe8 100644 Binary files a/MySQL_conf_pbx/test1/mariadb_data/aria_log.00000001 and b/MySQL_conf_pbx/test1/mariadb_data/aria_log.00000001 differ diff --git a/MySQL_conf_pbx/test1/mariadb_data/aria_log_control b/MySQL_conf_pbx/test1/mariadb_data/aria_log_control index 36e66bd..046d59e 100644 Binary files a/MySQL_conf_pbx/test1/mariadb_data/aria_log_control and b/MySQL_conf_pbx/test1/mariadb_data/aria_log_control differ diff --git a/MySQL_conf_pbx/test1/mariadb_data/asterisk_db/extensions_table.ibd b/MySQL_conf_pbx/test1/mariadb_data/asterisk_db/extensions_table.ibd index 1297ec9..41fa505 100644 Binary files a/MySQL_conf_pbx/test1/mariadb_data/asterisk_db/extensions_table.ibd and b/MySQL_conf_pbx/test1/mariadb_data/asterisk_db/extensions_table.ibd differ diff --git a/MySQL_conf_pbx/test1/mariadb_data/asterisk_db/ps_aors.ibd b/MySQL_conf_pbx/test1/mariadb_data/asterisk_db/ps_aors.ibd index 0779344..9785d38 100644 Binary files a/MySQL_conf_pbx/test1/mariadb_data/asterisk_db/ps_aors.ibd and b/MySQL_conf_pbx/test1/mariadb_data/asterisk_db/ps_aors.ibd differ diff --git a/MySQL_conf_pbx/test1/mariadb_data/asterisk_db/ps_auths.ibd b/MySQL_conf_pbx/test1/mariadb_data/asterisk_db/ps_auths.ibd index d67ab3b..1934d2a 100644 Binary files a/MySQL_conf_pbx/test1/mariadb_data/asterisk_db/ps_auths.ibd and b/MySQL_conf_pbx/test1/mariadb_data/asterisk_db/ps_auths.ibd differ diff --git a/MySQL_conf_pbx/test1/mariadb_data/asterisk_db/ps_endpoints.ibd b/MySQL_conf_pbx/test1/mariadb_data/asterisk_db/ps_endpoints.ibd index 9a7193e..e04003e 100644 Binary files a/MySQL_conf_pbx/test1/mariadb_data/asterisk_db/ps_endpoints.ibd and b/MySQL_conf_pbx/test1/mariadb_data/asterisk_db/ps_endpoints.ibd differ diff --git a/MySQL_conf_pbx/test1/mariadb_data/ib_buffer_pool b/MySQL_conf_pbx/test1/mariadb_data/ib_buffer_pool index 7f6ec6b..de03a0a 100644 --- a/MySQL_conf_pbx/test1/mariadb_data/ib_buffer_pool +++ b/MySQL_conf_pbx/test1/mariadb_data/ib_buffer_pool @@ -113,16 +113,13 @@ 2,18 1,18 3,17 -2,48 2,17 1,17 3,16 2,16 -1,49 1,16 3,45 3,15 -2,47 2,15 1,48 1,15 @@ -137,9 +134,7 @@ 2,12 1,12 3,11 -2,45 2,11 -1,47 1,11 3,10 2,10 @@ -154,6 +149,7 @@ 3,7 2,7 1,7 +3,46 3,6 2,6 1,6 diff --git a/MySQL_conf_pbx/test1/mariadb_data/ib_logfile0 b/MySQL_conf_pbx/test1/mariadb_data/ib_logfile0 index 52d0978..b31bbf5 100644 Binary files a/MySQL_conf_pbx/test1/mariadb_data/ib_logfile0 and b/MySQL_conf_pbx/test1/mariadb_data/ib_logfile0 differ diff --git a/MySQL_conf_pbx/test1/mariadb_data/ibdata1 b/MySQL_conf_pbx/test1/mariadb_data/ibdata1 index 8bbe94a..e088b51 100644 Binary files a/MySQL_conf_pbx/test1/mariadb_data/ibdata1 and b/MySQL_conf_pbx/test1/mariadb_data/ibdata1 differ diff --git a/MySQL_conf_pbx/test1/mariadb_data/mysql/innodb_index_stats.ibd b/MySQL_conf_pbx/test1/mariadb_data/mysql/innodb_index_stats.ibd index 7ff8acf..f2bbc7c 100644 Binary files a/MySQL_conf_pbx/test1/mariadb_data/mysql/innodb_index_stats.ibd and b/MySQL_conf_pbx/test1/mariadb_data/mysql/innodb_index_stats.ibd differ diff --git a/MySQL_conf_pbx/test1/mariadb_data/mysql/innodb_table_stats.ibd b/MySQL_conf_pbx/test1/mariadb_data/mysql/innodb_table_stats.ibd index d6dddcd..1c40a2c 100644 Binary files a/MySQL_conf_pbx/test1/mariadb_data/mysql/innodb_table_stats.ibd and b/MySQL_conf_pbx/test1/mariadb_data/mysql/innodb_table_stats.ibd differ diff --git a/MySQL_conf_pbx/test1/mariadb_data/undo001 b/MySQL_conf_pbx/test1/mariadb_data/undo001 index 2d6a685..4ee5ac6 100644 Binary files a/MySQL_conf_pbx/test1/mariadb_data/undo001 and b/MySQL_conf_pbx/test1/mariadb_data/undo001 differ diff --git a/MySQL_conf_pbx/test1/mariadb_data/undo002 b/MySQL_conf_pbx/test1/mariadb_data/undo002 index f1130e7..11fcff6 100644 Binary files a/MySQL_conf_pbx/test1/mariadb_data/undo002 and b/MySQL_conf_pbx/test1/mariadb_data/undo002 differ diff --git a/MySQL_conf_pbx/test1/mariadb_data/undo003 b/MySQL_conf_pbx/test1/mariadb_data/undo003 index 32619dc..ddcfc52 100644 Binary files a/MySQL_conf_pbx/test1/mariadb_data/undo003 and b/MySQL_conf_pbx/test1/mariadb_data/undo003 differ diff --git a/MySQL_conf_pbx/test1/recordings/1002-1744092445.4.wav b/MySQL_conf_pbx/test1/recordings/1002-1744092445.4.wav new file mode 100644 index 0000000..64ec696 Binary files /dev/null and b/MySQL_conf_pbx/test1/recordings/1002-1744092445.4.wav differ diff --git a/MySQL_conf_pbx/test1/recordings/1002-1744099477.6.wav b/MySQL_conf_pbx/test1/recordings/1002-1744099477.6.wav new file mode 100644 index 0000000..ccc48b8 Binary files /dev/null and b/MySQL_conf_pbx/test1/recordings/1002-1744099477.6.wav differ diff --git a/MySQL_conf_pbx/test1/recordings/1002-1744104023.9.wav b/MySQL_conf_pbx/test1/recordings/1002-1744104023.9.wav new file mode 100644 index 0000000..64ec696 Binary files /dev/null and b/MySQL_conf_pbx/test1/recordings/1002-1744104023.9.wav differ diff --git a/MySQL_conf_pbx/test1/recordings/1003-1744092280.0.wav b/MySQL_conf_pbx/test1/recordings/1003-1744092280.0.wav new file mode 100644 index 0000000..64ec696 Binary files /dev/null and b/MySQL_conf_pbx/test1/recordings/1003-1744092280.0.wav differ diff --git a/MySQL_conf_pbx/test1/recordings/1003-1744097713.8.wav b/MySQL_conf_pbx/test1/recordings/1003-1744097713.8.wav new file mode 100644 index 0000000..2deac95 Binary files /dev/null and b/MySQL_conf_pbx/test1/recordings/1003-1744097713.8.wav differ diff --git a/MySQL_conf_pbx/test1/recordings/1003-1744099037.0.wav b/MySQL_conf_pbx/test1/recordings/1003-1744099037.0.wav new file mode 100644 index 0000000..486db4e Binary files /dev/null and b/MySQL_conf_pbx/test1/recordings/1003-1744099037.0.wav differ diff --git a/MySQL_conf_pbx/test1/recordings/1003-1744099426.3.wav b/MySQL_conf_pbx/test1/recordings/1003-1744099426.3.wav new file mode 100644 index 0000000..64ec696 Binary files /dev/null and b/MySQL_conf_pbx/test1/recordings/1003-1744099426.3.wav differ diff --git a/MySQL_conf_pbx/test1/recordings/1003-1744105361.16.wav b/MySQL_conf_pbx/test1/recordings/1003-1744105361.16.wav new file mode 100644 index 0000000..4796bd9 Binary files /dev/null and b/MySQL_conf_pbx/test1/recordings/1003-1744105361.16.wav differ diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/DAO/BasicAsteriskOpsDAO.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/DAO/BasicAsteriskOpsDAO.java index 27efbed..ac7a909 100644 --- a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/DAO/BasicAsteriskOpsDAO.java +++ b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/DAO/BasicAsteriskOpsDAO.java @@ -1,9 +1,7 @@ package com.example.cezenPBX.DAO; import com.example.cezenPBX.DTO.ReturnStatus; -import com.example.cezenPBX.entity.ExtensionsTable; -import com.example.cezenPBX.entity.PsAuths; -import com.example.cezenPBX.entity.PsEndPoints; +import com.example.cezenPBX.entity.*; import jakarta.persistence.EntityManager; import jakarta.transaction.Transactional; import org.springframework.beans.factory.annotation.Autowired; @@ -17,8 +15,7 @@ public class BasicAsteriskOpsDAO implements CezenPbxOpsDAO { private EntityManager entityManager; // find end point details by id - @Override - public PsEndPoints findEndPontById(String id) { + private PsEndPoints findEndPontById(String id) { return this.entityManager.find(PsEndPoints.class, id); } @@ -38,19 +35,13 @@ public class BasicAsteriskOpsDAO implements CezenPbxOpsDAO { return true; } + // Save an extension @Override @Transactional public ReturnStatus saveAnExtension(ExtensionsTable extensionsTable) { - // check if endpoint exists - try{ - System.out.println("End point ID is " + findEndPontById(extensionsTable.getExtension()).getId()); - }catch (Exception e){ - return new ReturnStatus(false, "Create Endpoint for " + extensionsTable.getExtension(),e.toString() + " First"); - } - - this.entityManager.persist(extensionsTable); - return new ReturnStatus(true, extensionsTable.getExtension() + " Persisted ", ""); + //save only if endpoint exists + return persistOnlyIfEndpointExists(extensionsTable); } // the method persists @@ -58,16 +49,29 @@ public class BasicAsteriskOpsDAO implements CezenPbxOpsDAO { @Transactional public ReturnStatus setThePasswordForSipEndpoint(PsAuths psAuths) { - //check if endpoint exists - try{ - System.out.println("End point ID is " + findEndPontById(psAuths.getId())); - }catch (Exception e){ - return new ReturnStatus(false, "Create Endpoint for " + findEndPontById(psAuths.getId()),e.toString() + " First"); - } - - this.entityManager.persist(psAuths); - return new ReturnStatus(true, psAuths.getId() + " Persisted ", ""); + //save only if endpoint exists + return persistOnlyIfEndpointExists(psAuths); } + @Override + @Transactional + public ReturnStatus setTheAorsForTheEndPoint(PsAors psAors) { + + //save only if endpoint exists + return persistOnlyIfEndpointExists(psAors); + } + + private ReturnStatus persistOnlyIfEndpointExists(PBXentiry pbXentiry){ + + String endpoint = pbXentiry.getExtension(); + + // check if the endpoint exists + if(findEndPontById(endpoint) == null){ + return new ReturnStatus(false, "Create Endpoint for " + endpoint, " "); + } + // then persist + this.entityManager.persist(pbXentiry); + return new ReturnStatus(true, endpoint + " Persisted ", ""); + } } diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/DAO/CezenPbxOpsDAO.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/DAO/CezenPbxOpsDAO.java index 6d374fd..cc2a763 100644 --- a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/DAO/CezenPbxOpsDAO.java +++ b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/DAO/CezenPbxOpsDAO.java @@ -2,16 +2,17 @@ package com.example.cezenPBX.DAO; import com.example.cezenPBX.DTO.ReturnStatus; import com.example.cezenPBX.entity.ExtensionsTable; +import com.example.cezenPBX.entity.PsAors; import com.example.cezenPBX.entity.PsAuths; import com.example.cezenPBX.entity.PsEndPoints; public interface CezenPbxOpsDAO { - PsEndPoints findEndPontById(String id); - boolean addNewEndPoint(PsEndPoints psEndPoints); ReturnStatus saveAnExtension(ExtensionsTable extensionsTable); ReturnStatus setThePasswordForSipEndpoint(PsAuths psAuths); + + ReturnStatus setTheAorsForTheEndPoint(PsAors psAors); } diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/DTO/PsAorsDTO.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/DTO/PsAorsDTO.java new file mode 100644 index 0000000..4246484 --- /dev/null +++ b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/DTO/PsAorsDTO.java @@ -0,0 +1,4 @@ +package com.example.cezenPBX.DTO; + +public record PsAorsDTO(String id, int maxContacts) { +} diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/controller/CezenPbxController.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/controller/CezenPbxController.java index 945e5e6..c4f186e 100644 --- a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/controller/CezenPbxController.java +++ b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/controller/CezenPbxController.java @@ -1,8 +1,5 @@ package com.example.cezenPBX.controller; -import com.example.cezenPBX.DTO.ExtensionsDTO; -import com.example.cezenPBX.DTO.PsEndPointsDTO; -import com.example.cezenPBX.DTO.ReturnStatus; -import com.example.cezenPBX.DTO.SipPasswordDTO; +import com.example.cezenPBX.DTO.*; import com.example.cezenPBX.service.BasicPbxServiceInterface; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -68,4 +65,13 @@ public class CezenPbxController { sipPasswordDTO.realm() ); } + + @PostMapping("/set_aors") + public ReturnStatus setAorsForSipEndpoint(@RequestBody PsAorsDTO psAorsDTO){ + + return this.basicPbxServiceInterface.setAors( + psAorsDTO.id(), + psAorsDTO.maxContacts() + ); + } } diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/entity/ExtensionsTable.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/entity/ExtensionsTable.java index e8a0b19..a8b2d6e 100644 --- a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/entity/ExtensionsTable.java +++ b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/entity/ExtensionsTable.java @@ -5,7 +5,7 @@ import jdk.jfr.Name; @Entity @Table(name = "extensions_table") -public class ExtensionsTable { +public class ExtensionsTable implements PBXentiry{ @Id @GeneratedValue(strategy = GenerationType.IDENTITY) diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/entity/PBXentiry.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/entity/PBXentiry.java new file mode 100644 index 0000000..c8c4b53 --- /dev/null +++ b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/entity/PBXentiry.java @@ -0,0 +1,6 @@ +package com.example.cezenPBX.entity; + +public interface PBXentiry { + + public String getExtension(); +} diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/entity/PsAors.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/entity/PsAors.java new file mode 100644 index 0000000..b998324 --- /dev/null +++ b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/entity/PsAors.java @@ -0,0 +1,39 @@ +package com.example.cezenPBX.entity; + +import jakarta.persistence.*; + +@Table(name = "ps_aors") +@Entity +public class PsAors implements PBXentiry{ + + @Id + @Column(name = "id") + private String extension; + + @Column(name = "max_contacts") + private int maxContacts; + + public PsAors(String extension, int maxContacts) { + this.extension = extension; + this.maxContacts = maxContacts; + } + + public PsAors() { + } + + public String getExtension() { + return extension; + } + + public void setExtension(String extension) { + this.extension = extension; + } + + public int getMaxContacts() { + return maxContacts; + } + + public void setMaxContacts(int maxContacts) { + this.maxContacts = maxContacts; + } +} diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/entity/PsAuths.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/entity/PsAuths.java index ae8d9be..795337a 100644 --- a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/entity/PsAuths.java +++ b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/entity/PsAuths.java @@ -7,11 +7,11 @@ import jakarta.persistence.Table; @Table(name = "ps_auths") @Entity -public class PsAuths { +public class PsAuths implements PBXentiry{ @Id @Column(name = "id") - private String id; + private String extension; @Column(name = "auth_type") private String authType; @@ -29,8 +29,8 @@ public class PsAuths { private String realm; - public PsAuths(String id, String authType, String userName, String password, String md5Cred, String realm) { - this.id = id; + public PsAuths(String extension, String authType, String userName, String password, String md5Cred, String realm) { + this.extension = extension; this.authType = authType; this.userName = userName; this.password = password; @@ -38,12 +38,12 @@ public class PsAuths { this.realm = realm; } - public String getId() { - return id; + public String getExtension() { + return extension; } - public void setId(String id) { - this.id = id; + public void setExtension(String extension) { + this.extension = extension; } public String getAuthType() { diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/entity/PsEndPoints.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/entity/PsEndPoints.java index 72ec4b3..384d6a7 100644 --- a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/entity/PsEndPoints.java +++ b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/entity/PsEndPoints.java @@ -7,11 +7,11 @@ import jakarta.persistence.Table; @Entity @Table(name = "ps_endpoints") -public class PsEndPoints { +public class PsEndPoints implements PBXentiry{ @Id @Column(name = "id") - private String id; + private String extension; @Column(name = "transport") private String transport; @@ -49,10 +49,10 @@ public class PsEndPoints { @Column(name = "mailboxes") private String mailboxes; - public PsEndPoints(String id, String transport, String aors, String auth, String context, + public PsEndPoints(String extension, String transport, String aors, String auth, String context, String disallow, String allow, String directMedia, String connectedLineMethod, String callerid, String dtmfMode, String mohsuggest, String mailboxes) { - this.id = id; + this.extension = extension; this.transport = transport; this.aors = aors; this.auth = auth; @@ -70,8 +70,8 @@ public class PsEndPoints { public PsEndPoints() { } - public String getId() { - return id; + public String getExtension() { + return extension; } public String getTransport() { diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/service/BasicPbxService.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/service/BasicPbxService.java index 7071077..0efc5c7 100644 --- a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/service/BasicPbxService.java +++ b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/service/BasicPbxService.java @@ -3,6 +3,7 @@ package com.example.cezenPBX.service; import com.example.cezenPBX.DAO.CezenPbxOpsDAO; import com.example.cezenPBX.DTO.ReturnStatus; import com.example.cezenPBX.entity.ExtensionsTable; +import com.example.cezenPBX.entity.PsAors; import com.example.cezenPBX.entity.PsAuths; import com.example.cezenPBX.entity.PsEndPoints; import org.springframework.beans.factory.annotation.Autowired; @@ -81,4 +82,16 @@ public class BasicPbxService implements BasicPbxServiceInterface { return new ReturnStatus(false, "Endpoint and password already set ",e.getMessage()); } } + + @Override + public ReturnStatus setAors(String id, int maxContacts) { + + PsAors psAors = new PsAors(id, maxContacts); + + try{ + return this.cezenPbxOpsDAO.setTheAorsForTheEndPoint(psAors); + }catch (Exception e){ + return new ReturnStatus(false, "Endpoint and password already set ",e.getMessage()); + } + } } diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/service/BasicPbxServiceInterface.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/service/BasicPbxServiceInterface.java index 1567ca6..9967d86 100644 --- a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/service/BasicPbxServiceInterface.java +++ b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/service/BasicPbxServiceInterface.java @@ -14,4 +14,6 @@ public interface BasicPbxServiceInterface { public ReturnStatus addExtensionForUser(String context, String extension, int priority, String app, String appdata); public ReturnStatus addAPasswordForEndpoint(String id, String authType, String userName, String password, String md5Cred, String realm); + + public ReturnStatus setAors(String id, int maxContacts); } diff --git a/MySQL_conf_pbx/test1/voicemail_data/default/1002/INBOX/msg0008.txt b/MySQL_conf_pbx/test1/voicemail_data/default/1002/INBOX/msg0008.txt new file mode 100644 index 0000000..3f13f7c --- /dev/null +++ b/MySQL_conf_pbx/test1/voicemail_data/default/1002/INBOX/msg0008.txt @@ -0,0 +1,18 @@ +; +; Message Information file +; +[message] +origmailbox=1002 +context=default +macrocontext= +exten=1002 +rdnis=unknown +priority=30 +callerchan=PJSIP/1003-00000002 +callerid="mat@1003" <1003> +origdate=Tue Apr 8 06:07:42 AM UTC 2025 +origtime=1744092462 +category= +msg_id=1744092462-00000000 +flag= +duration=0 diff --git a/MySQL_conf_pbx/test1/voicemail_data/default/1002/INBOX/msg0008.wav b/MySQL_conf_pbx/test1/voicemail_data/default/1002/INBOX/msg0008.wav new file mode 100644 index 0000000..64ec696 Binary files /dev/null and b/MySQL_conf_pbx/test1/voicemail_data/default/1002/INBOX/msg0008.wav differ