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 3aa723c..67e26b2 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\": \"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\": \"invite\",\n \"callerid\": \"User <1004>\",\n \"dtmfMode\": \"rfc4733\",\n \"mohsuggest\": \"default\",\n \"mailboxes\": \"1004@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\": \"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// }", "options": { "raw": { "language": "json" @@ -36,13 +36,13 @@ "response": [] }, { - "name": "New Request", + "name": "create a new extension", "request": { "method": "POST", "header": [], "body": { "mode": "raw", - "raw": "{\n \"context\": \"default\",\n \"extension\": \"1004\",\n \"priority\": 2,\n \"app\": \"Dial\",\n \"appdata\": \"PJSIP/1004,20,m(default)\"\n}\n", + "raw": "{\n \"context\": \"default\",\n \"extension\": \"1005\",\n \"priority\": 2,\n \"app\": \"Dial\",\n \"appdata\": \"PJSIP/1005,20,m(default)\"\n}\n", "options": { "raw": { "language": "json" @@ -63,6 +63,35 @@ } }, "response": [] + }, + { + "name": "set_password", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"id\": \"1005\",\n \"authType\": \"userpass\",\n \"userName\": \"1005\",\n \"password\": \"12345\",\n \"md5Cred\": null,\n \"realm\": null\n}\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:8081/cezen/set_password", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "8081", + "path": [ + "cezen", + "set_password" + ] + } + }, + "response": [] } ] } \ No newline at end of file diff --git a/MySQL_conf_pbx/test1/Script-1.sql b/MySQL_conf_pbx/test1/db_asterisk/Script-1.sql similarity index 100% rename from MySQL_conf_pbx/test1/Script-1.sql rename to MySQL_conf_pbx/test1/db_asterisk/Script-1.sql diff --git a/MySQL_conf_pbx/test1/dial_plan_and_Ext.sql b/MySQL_conf_pbx/test1/db_asterisk/dial_plan_and_Ext.sql similarity index 100% rename from MySQL_conf_pbx/test1/dial_plan_and_Ext.sql rename to MySQL_conf_pbx/test1/db_asterisk/dial_plan_and_Ext.sql diff --git a/MySQL_conf_pbx/test1/sping_db.sql b/MySQL_conf_pbx/test1/db_asterisk/sping_db.sql similarity index 100% rename from MySQL_conf_pbx/test1/sping_db.sql rename to MySQL_conf_pbx/test1/db_asterisk/sping_db.sql diff --git a/MySQL_conf_pbx/test1/theAlter.sql b/MySQL_conf_pbx/test1/db_asterisk/theAlter.sql similarity index 100% rename from MySQL_conf_pbx/test1/theAlter.sql rename to MySQL_conf_pbx/test1/db_asterisk/theAlter.sql diff --git a/MySQL_conf_pbx/test1/three_users.sql b/MySQL_conf_pbx/test1/db_asterisk/three_users.sql similarity index 100% rename from MySQL_conf_pbx/test1/three_users.sql rename to MySQL_conf_pbx/test1/db_asterisk/three_users.sql diff --git a/MySQL_conf_pbx/test1/voicemaiDbSchema.sql b/MySQL_conf_pbx/test1/db_asterisk/voicemaiDbSchema.sql similarity index 100% rename from MySQL_conf_pbx/test1/voicemaiDbSchema.sql rename to MySQL_conf_pbx/test1/db_asterisk/voicemaiDbSchema.sql diff --git a/MySQL_conf_pbx/test1/mariadb_data/aria_log.00000001 b/MySQL_conf_pbx/test1/mariadb_data/aria_log.00000001 index e2ba8bf..4fa9f8f 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 9fd86f2..36e66bd 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 01280c0..1297ec9 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 d615791..0779344 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 22a00ed..d67ab3b 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 f34f7da..9a7193e 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/ddl_recovery.log b/MySQL_conf_pbx/test1/mariadb_data/ddl_recovery.log index 8a528aa..5e30b6d 100644 Binary files a/MySQL_conf_pbx/test1/mariadb_data/ddl_recovery.log and b/MySQL_conf_pbx/test1/mariadb_data/ddl_recovery.log differ diff --git a/MySQL_conf_pbx/test1/mariadb_data/ib_buffer_pool b/MySQL_conf_pbx/test1/mariadb_data/ib_buffer_pool index 25c0453..7f6ec6b 100644 --- a/MySQL_conf_pbx/test1/mariadb_data/ib_buffer_pool +++ b/MySQL_conf_pbx/test1/mariadb_data/ib_buffer_pool @@ -2,6 +2,8 @@ 13,2 13,1 13,0 +11,5 +11,4 11,3 11,2 11,1 @@ -111,13 +113,18 @@ 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 3,14 2,14 @@ -126,10 +133,13 @@ 2,13 1,13 3,12 +2,46 2,12 1,12 3,11 +2,45 2,11 +1,47 1,11 3,10 2,10 @@ -139,6 +149,7 @@ 1,9 3,8 2,8 +1,46 1,8 3,7 2,7 diff --git a/MySQL_conf_pbx/test1/mariadb_data/ib_logfile0 b/MySQL_conf_pbx/test1/mariadb_data/ib_logfile0 index 0b22ac9..52d0978 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 ab971db..8bbe94a 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 98c5b5a..7ff8acf 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 8985a06..d6dddcd 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 e353f09..2d6a685 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 fe08f44..f1130e7 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 467c100..32619dc 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/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 d754dae..27efbed 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 @@ -2,6 +2,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 jakarta.persistence.EntityManager; import jakarta.transaction.Transactional; @@ -40,18 +41,33 @@ public class BasicAsteriskOpsDAO implements CezenPbxOpsDAO { @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 First for " + extensionsTable.getExtension(),e.toString()); + return new ReturnStatus(false, "Create Endpoint for " + extensionsTable.getExtension(),e.toString() + " First"); } - System.out.println("Context in DAO is " + extensionsTable.getContext()); - this.entityManager.persist(extensionsTable); return new ReturnStatus(true, extensionsTable.getExtension() + " Persisted ", ""); } + + // the method persists + @Override + @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 ", ""); + } + + } 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 b96be38..6d374fd 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,6 +2,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; public interface CezenPbxOpsDAO { @@ -11,4 +12,6 @@ public interface CezenPbxOpsDAO { boolean addNewEndPoint(PsEndPoints psEndPoints); ReturnStatus saveAnExtension(ExtensionsTable extensionsTable); + + ReturnStatus setThePasswordForSipEndpoint(PsAuths psAuths); } diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/DTO/SipPasswordDTO.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/DTO/SipPasswordDTO.java new file mode 100644 index 0000000..0a39697 --- /dev/null +++ b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/DTO/SipPasswordDTO.java @@ -0,0 +1,4 @@ +package com.example.cezenPBX.DTO; + +public record SipPasswordDTO(String id, String authType, String userName, String password, String md5Cred, String realm) { +} 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 b023128..945e5e6 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,8 @@ 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.service.BasicPbxServiceInterface; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -54,4 +54,18 @@ public class CezenPbxController { extensionsDTO.app(), extensionsDTO.appdata()); } + + + @PostMapping("/set_password") + public ReturnStatus setPasswordForSipEndpoint(@RequestBody SipPasswordDTO sipPasswordDTO){ + + return this.basicPbxServiceInterface.addAPasswordForEndpoint( + sipPasswordDTO.id(), + sipPasswordDTO.authType(), + sipPasswordDTO.userName(), + sipPasswordDTO.password(), + sipPasswordDTO.md5Cred(), + sipPasswordDTO.realm() + ); + } } 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 0b6c7c1..e8a0b19 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 @@ -10,22 +10,22 @@ public class ExtensionsTable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") - int id; + private int id; @Column(name = "context") - String context; + private String context; @Column(name = "exten") - String extension; + private String extension; @Column(name = "priority") - int priority; + private int priority; @Column(name = "app") - String app; + private String app; @Column(name = "appdata") - String appdata; + private String appdata; public ExtensionsTable(){} 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 new file mode 100644 index 0000000..ae8d9be --- /dev/null +++ b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/entity/PsAuths.java @@ -0,0 +1,88 @@ +package com.example.cezenPBX.entity; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Table; + +@Table(name = "ps_auths") +@Entity +public class PsAuths { + + @Id + @Column(name = "id") + private String id; + + @Column(name = "auth_type") + private String authType; + + @Column(name = "username") + private String userName; + + @Column(name = "password") + private String password; + + @Column(name = "md5_cred") + private String md5Cred; + + @Column(name = "realm") + private String realm; + + + public PsAuths(String id, String authType, String userName, String password, String md5Cred, String realm) { + this.id = id; + this.authType = authType; + this.userName = userName; + this.password = password; + this.md5Cred = md5Cred; + this.realm = realm; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getAuthType() { + return authType; + } + + public void setAuthType(String authType) { + this.authType = authType; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getMd5Cred() { + return md5Cred; + } + + public void setMd5Cred(String md5Cred) { + this.md5Cred = md5Cred; + } + + public String getRealm() { + return realm; + } + + public void setRealm(String realm) { + this.realm = realm; + } +} 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 af7cb57..72ec4b3 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 @@ -11,43 +11,43 @@ public class PsEndPoints { @Id @Column(name = "id") - String id; + private String id; @Column(name = "transport") - String transport; + private String transport; @Column(name = "aors") - String aors; + private String aors; @Column(name = "auth") - String auth; + private String auth; @Column(name = "context") - String context; + private String context; @Column(name = "disallow") - String disallow; + private String disallow; @Column(name = "allow") - String allow; + private String allow; @Column(name = "direct_media") - String directMedia; + private String directMedia; @Column(name = "connected_line_method") - String connectedLineMethod; + private String connectedLineMethod; @Column(name = "callerid") - String callerid; + private String callerid; @Column(name = "dtmf_mode") - String dtmfMode; + private String dtmfMode; @Column(name = "mohsuggest") - String mohsuggest; + private String mohsuggest; @Column(name = "mailboxes") - String mailboxes; + private String mailboxes; public PsEndPoints(String id, String transport, String aors, String auth, String context, String disallow, String allow, String directMedia, String connectedLineMethod, 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 1cb5784..7071077 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.PsAuths; import com.example.cezenPBX.entity.PsEndPoints; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -53,17 +54,31 @@ public class BasicPbxService implements BasicPbxServiceInterface { try{ // create a new entity of extension - this.cezenPbxOpsDAO.saveAnExtension(new ExtensionsTable( + return this.cezenPbxOpsDAO.saveAnExtension(new ExtensionsTable( context, extension, priority, app, appdata )); - return new ReturnStatus(true, extension + " Persisted ", ""); }catch ( Exception e){ // the persisting data already exists or it's a db issue return new ReturnStatus(false, "Data likely already exists or DB issue",e.getMessage()); } } + + @Override + public ReturnStatus addAPasswordForEndpoint(String id, String authType, String userName, String password, String md5Cred, String realm) { + + // create the new endpoint password instance + PsAuths psAuths = new PsAuths(id, authType, userName, password, md5Cred, realm); + + // send it to the DAO + try{ + return this.cezenPbxOpsDAO.setThePasswordForSipEndpoint(psAuths); + + }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 056a7c8..1567ca6 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 @@ -12,4 +12,6 @@ public interface BasicPbxServiceInterface { // provided the user exists returns message of error or status 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); }