mirror of
https://github.com/jambonz/jambonz-webapp.git
synced 2026-07-04 19:21:58 +00:00
wip
This commit is contained in:
@@ -1408,202 +1408,164 @@ export const CarrierForm = ({
|
|||||||
</MXS>
|
</MXS>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
{trunkType === "reg" ? (
|
{/* Authentication Fields - shared component */}
|
||||||
// For registration trunk, show fields directly without checkzone
|
{(() => {
|
||||||
<div>
|
const authFields = (
|
||||||
<div className="label">Authentication</div>
|
<>
|
||||||
<MS>
|
<label htmlFor="sip_username">
|
||||||
Registration trunk requires authentication credentials.
|
Auth username{" "}
|
||||||
</MS>
|
{(sipPass || sipRegister || trunkType === "reg") && (
|
||||||
<label htmlFor="sip_username">
|
<span>*</span>
|
||||||
Auth username <span>*</span>
|
)}
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
id="sip_username"
|
id="sip_username"
|
||||||
name="sip_username"
|
name="sip_username"
|
||||||
type="text"
|
type="text"
|
||||||
value={sipUser}
|
value={sipUser}
|
||||||
placeholder="SIP username for authenticating outbound calls"
|
placeholder="SIP username for authenticating outbound calls"
|
||||||
required
|
required={
|
||||||
onChange={(e) => {
|
trunkType === "reg" || sipRegister || sipPass.length > 0
|
||||||
setSipUser(e.target.value);
|
}
|
||||||
}}
|
onChange={(e) => setSipUser(e.target.value)}
|
||||||
/>
|
/>
|
||||||
<label htmlFor="sip_password">
|
<label htmlFor="sip_password">
|
||||||
Password <span>*</span>
|
Password{" "}
|
||||||
</label>
|
{(sipUser || sipRegister || trunkType === "reg") && (
|
||||||
<Passwd
|
<span>*</span>
|
||||||
id="sip_password"
|
)}
|
||||||
name="sip_password"
|
</label>
|
||||||
value={sipPass}
|
<Passwd
|
||||||
placeholder="SIP password for authenticating outbound calls"
|
id="sip_password"
|
||||||
required
|
name="sip_password"
|
||||||
onChange={(e) => {
|
value={sipPass}
|
||||||
setSipPass(e.target.value);
|
placeholder="SIP password for authenticating outbound calls"
|
||||||
}}
|
required={
|
||||||
/>
|
trunkType === "reg" || sipRegister || sipUser.length > 0
|
||||||
</div>
|
}
|
||||||
) : (
|
onChange={(e) => setSipPass(e.target.value)}
|
||||||
<Checkzone
|
/>
|
||||||
key={`sip_credentials_${trunkType}`}
|
</>
|
||||||
hidden
|
);
|
||||||
name="sip_credentials"
|
|
||||||
label="Authentication"
|
if (trunkType === "reg") {
|
||||||
initialCheck={initialRegister}
|
return (
|
||||||
handleChecked={(e) => {
|
<div>
|
||||||
if (!e.target.checked) {
|
<div className="label">Authentication</div>
|
||||||
setSipUser("");
|
<MS>
|
||||||
setSipPass("");
|
Registration trunk requires authentication credentials.
|
||||||
setSipRegister(false);
|
</MS>
|
||||||
}
|
{authFields}
|
||||||
}}
|
</div>
|
||||||
>
|
);
|
||||||
<MS>Does your carrier require authentication?</MS>
|
} else {
|
||||||
<label htmlFor="sip_username">
|
return (
|
||||||
Auth username {sipPass || sipRegister ? <span>*</span> : ""}
|
<Checkzone
|
||||||
</label>
|
key={`sip_credentials_${trunkType}`}
|
||||||
<input
|
hidden
|
||||||
id="sip_username"
|
name="sip_credentials"
|
||||||
name="sip_username"
|
label="Authentication"
|
||||||
type="text"
|
initialCheck={initialRegister}
|
||||||
value={sipUser}
|
handleChecked={(e) => {
|
||||||
placeholder="SIP username for authenticating outbound calls"
|
if (!e.target.checked) {
|
||||||
required={sipRegister || sipPass.length > 0}
|
setSipUser("");
|
||||||
onChange={(e) => {
|
setSipPass("");
|
||||||
setSipUser(e.target.value);
|
setSipRegister(false);
|
||||||
}}
|
}
|
||||||
/>
|
}}
|
||||||
<label htmlFor="sip_password">
|
>
|
||||||
Password
|
<MS>Does your carrier require authentication?</MS>
|
||||||
{sipUser || sipRegister ? <span>*</span> : ""}
|
{authFields}
|
||||||
</label>
|
</Checkzone>
|
||||||
<Passwd
|
);
|
||||||
id="sip_password"
|
}
|
||||||
name="sip_password"
|
})()}
|
||||||
value={sipPass}
|
|
||||||
placeholder="SIP password for authenticating outbound calls"
|
|
||||||
required={sipRegister || sipUser.length > 0}
|
|
||||||
onChange={(e) => {
|
|
||||||
setSipPass(e.target.value);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Checkzone>
|
|
||||||
)}
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
{trunkType === "reg" ? (
|
{/* SIP Registration Fields - shared component */}
|
||||||
// For registration trunk, show fields directly without checkzone
|
{(() => {
|
||||||
<div>
|
const sipRegFields = (
|
||||||
<div className="label">SIP Registration</div>
|
<>
|
||||||
<MS>
|
<label htmlFor="sip_realm">
|
||||||
Registration trunk requires SIP registration settings.
|
SIP realm{" "}
|
||||||
</MS>
|
{(sipRegister || trunkType === "reg") && <span>*</span>}
|
||||||
<label htmlFor="sip_realm">
|
</label>
|
||||||
SIP realm <span>*</span>
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
id="sip_realm"
|
|
||||||
name="sip_realm"
|
|
||||||
type="text"
|
|
||||||
value={sipRealm}
|
|
||||||
placeholder="SIP realm for registration"
|
|
||||||
required
|
|
||||||
onChange={(e) => setSipRealm(e.target.value)}
|
|
||||||
/>
|
|
||||||
<label htmlFor="from_user">Username</label>
|
|
||||||
<input
|
|
||||||
id="from_user"
|
|
||||||
name="from_user"
|
|
||||||
type="text"
|
|
||||||
value={fromUser}
|
|
||||||
placeholder="Optional: specify user part of SIP From header"
|
|
||||||
onChange={(e) => setFromUser(e.target.value)}
|
|
||||||
/>
|
|
||||||
<label htmlFor="from_domain">SIP from domain</label>
|
|
||||||
<input
|
|
||||||
id="from_domain"
|
|
||||||
name="from_domain"
|
|
||||||
type="text"
|
|
||||||
value={fromDomain}
|
|
||||||
placeholder="Optional: specify host part of SIP From header"
|
|
||||||
onChange={(e) => setFromDomain(e.target.value)}
|
|
||||||
/>
|
|
||||||
<label htmlFor="reg_public_ip_in_contact_3" className="chk">
|
|
||||||
<input
|
<input
|
||||||
id="reg_public_ip_in_contact_3"
|
id="sip_realm"
|
||||||
name="reg_public_ip_in_contact_3"
|
name="sip_realm"
|
||||||
type="checkbox"
|
type="text"
|
||||||
checked={regPublicIpInContact}
|
value={sipRealm}
|
||||||
onChange={(e) =>
|
placeholder="SIP realm for registration"
|
||||||
setRegPublicIpInContact(e.target.checked)
|
required={trunkType === "reg" || sipRegister}
|
||||||
}
|
onChange={(e) => setSipRealm(e.target.value)}
|
||||||
/>
|
/>
|
||||||
<div>Use public IP in contact</div>
|
<label htmlFor="from_user">Username</label>
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<Checkzone
|
|
||||||
key={`sip_register_${trunkType}`}
|
|
||||||
hidden
|
|
||||||
name="sip_register"
|
|
||||||
label="Require SIP Register"
|
|
||||||
initialCheck={initialSipRegister}
|
|
||||||
handleChecked={(e) => {
|
|
||||||
setSipRegister(e.target.checked);
|
|
||||||
if (!e.target.checked) {
|
|
||||||
setSipRealm("");
|
|
||||||
setFromUser("");
|
|
||||||
setFromDomain("");
|
|
||||||
setRegPublicIpInContact(false);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<MS>Carrier requires SIP Register.</MS>
|
|
||||||
<label htmlFor="sip_realm">
|
|
||||||
SIP realm
|
|
||||||
{sipRegister ? <span>*</span> : ""}
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
id="sip_realm"
|
|
||||||
name="sip_realm"
|
|
||||||
type="text"
|
|
||||||
value={sipRealm}
|
|
||||||
placeholder="SIP realm for registration"
|
|
||||||
required={sipRegister}
|
|
||||||
onChange={(e) => setSipRealm(e.target.value)}
|
|
||||||
/>
|
|
||||||
<label htmlFor="from_user">Username</label>
|
|
||||||
<input
|
|
||||||
id="from_user"
|
|
||||||
name="from_user"
|
|
||||||
type="text"
|
|
||||||
value={fromUser}
|
|
||||||
placeholder="Optional: specify user part of SIP From header"
|
|
||||||
onChange={(e) => setFromUser(e.target.value)}
|
|
||||||
/>
|
|
||||||
<label htmlFor="from_domain">SIP from domain</label>
|
|
||||||
<input
|
|
||||||
id="from_domain"
|
|
||||||
name="from_domain"
|
|
||||||
type="text"
|
|
||||||
value={fromDomain}
|
|
||||||
placeholder="Optional: specify host part of SIP From header"
|
|
||||||
onChange={(e) => setFromDomain(e.target.value)}
|
|
||||||
/>
|
|
||||||
<label htmlFor="reg_public_ip_in_contact_2" className="chk">
|
|
||||||
<input
|
<input
|
||||||
id="reg_public_ip_in_contact_2"
|
id="from_user"
|
||||||
name="reg_public_ip_in_contact_2"
|
name="from_user"
|
||||||
type="checkbox"
|
type="text"
|
||||||
checked={regPublicIpInContact}
|
value={fromUser}
|
||||||
onChange={(e) =>
|
placeholder="Optional: specify user part of SIP From header"
|
||||||
setRegPublicIpInContact(e.target.checked)
|
onChange={(e) => setFromUser(e.target.value)}
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
<div>Use public IP in contact</div>
|
<label htmlFor="from_domain">SIP from domain</label>
|
||||||
</label>
|
<input
|
||||||
</Checkzone>
|
id="from_domain"
|
||||||
)}
|
name="from_domain"
|
||||||
|
type="text"
|
||||||
|
value={fromDomain}
|
||||||
|
placeholder="Optional: specify host part of SIP From header"
|
||||||
|
onChange={(e) => setFromDomain(e.target.value)}
|
||||||
|
/>
|
||||||
|
<label htmlFor="reg_public_ip_in_contact" className="chk">
|
||||||
|
<input
|
||||||
|
id="reg_public_ip_in_contact"
|
||||||
|
name="reg_public_ip_in_contact"
|
||||||
|
type="checkbox"
|
||||||
|
checked={regPublicIpInContact}
|
||||||
|
onChange={(e) =>
|
||||||
|
setRegPublicIpInContact(e.target.checked)
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<div>Use public IP in contact</div>
|
||||||
|
</label>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
|
||||||
|
if (trunkType === "reg") {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<div className="label">SIP Registration</div>
|
||||||
|
<MS>
|
||||||
|
Registration trunk requires SIP registration settings.
|
||||||
|
</MS>
|
||||||
|
{sipRegFields}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return (
|
||||||
|
<Checkzone
|
||||||
|
key={`sip_register_${trunkType}`}
|
||||||
|
hidden
|
||||||
|
name="sip_register"
|
||||||
|
label="Require SIP Register"
|
||||||
|
initialCheck={initialSipRegister}
|
||||||
|
handleChecked={(e) => {
|
||||||
|
setSipRegister(e.target.checked);
|
||||||
|
if (!e.target.checked) {
|
||||||
|
setSipRealm("");
|
||||||
|
setFromUser("");
|
||||||
|
setFromDomain("");
|
||||||
|
setRegPublicIpInContact(false);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<MS>Carrier requires SIP Register.</MS>
|
||||||
|
{sipRegFields}
|
||||||
|
</Checkzone>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})()}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<Checkzone
|
<Checkzone
|
||||||
|
|||||||
Reference in New Issue
Block a user