Compare commits
173 Commits
Author | SHA1 | Date |
---|---|---|
Naveen Albert | 7f51313725 | |
Naveen Albert | e1dfa20797 | |
Sean Bright | e33bab1bfd | |
Sean Bright | ce8b564509 | |
Stanislav Abramenkov | 72310b5575 | |
Sean Bright | 17cf90cc8b | |
Maximilian Fridrich | c5a6d8a6db | |
George Joseph | 51790abba7 | |
George Joseph | a02a929d27 | |
Naveen Albert | bdf9327a33 | |
Naveen Albert | 2ac9c8fb5c | |
Shaaah | 6f99268f79 | |
Naveen Albert | 190b6eafb3 | |
Sean Bright | 1a94502551 | |
George Joseph | 94176ecb88 | |
George Joseph | 1b94c90524 | |
George Joseph | 215424aa76 | |
George Joseph | d58ca20247 | |
George Joseph | 2e0d837e01 | |
Sebastian Jennen | 3c72bc8a7b | |
Shyju Kanaprath | 07055dce94 | |
Sean Bright | 31ab82840b | |
George Joseph | 2d1a4bab25 | |
George Joseph | 4077b4b340 | |
romryz | a7a03bc294 | |
Naveen Albert | 6ddcdfce1f | |
George Joseph | adcfbcd50e | |
George Joseph | a5ae546b88 | |
Naveen Albert | d0d09ef010 | |
Ben Ford | 6efa51f512 | |
Flole998 | c7fc6ae362 | |
cmaj | c863e0d77d | |
Joshua C. Colp | 8ce69eda14 | |
Mike Bradeen | 69fe814813 | |
George Joseph | 9baf49497e | |
Naveen Albert | ed39406838 | |
Sean Bright | 841cd1480c | |
Brad Smith | 9deb4c679e | |
Brad Smith | ec2c10689f | |
Sean Bright | 9f20b4659f | |
Sean Bright | 671b47cfda | |
Naveen Albert | 874ee6e9aa | |
Naveen Albert | ef891529fa | |
Sean Bright | 03ad690276 | |
Mike Bradeen | a22db8fd60 | |
Naveen Albert | 4b908f364d | |
Naveen Albert | 6fd6f22b2b | |
PeterHolik | 3b46872a8f | |
PeterHolik | 6fe045fd64 | |
Naveen Albert | 67088b256d | |
George Joseph | c31cd32b82 | |
Naveen Albert | 7683259f37 | |
Maximilian Fridrich | 81188ada5f | |
Naveen Albert | 1bf4493371 | |
Naveen Albert | bb364fc61f | |
George Joseph | 120cc1ea11 | |
George Joseph | df958a7d63 | |
Gitea | 510f7798d8 | |
Mike Bradeen | 6bc81d0c86 | |
George Joseph | b9ebccf064 | |
Ben Ford | b05d7e8901 | |
Naveen Albert | d20c3e2f6f | |
Naveen Albert | 09bd80c627 | |
Sean Bright | e001a1b6d3 | |
Naveen Albert | 3bb34477d4 | |
George Joseph | 751f8649fd | |
Maximilian Fridrich | 366dc1e99f | |
Sean Bright | 16a42b2aec | |
George Joseph | aec2453688 | |
Sean Bright | 1d05e34d98 | |
Matthew Fredrickson | e0bf65bde6 | |
Sean Bright | 002d6c2108 | |
Sean Bright | b437cc3267 | |
Sean Bright | 5f0b568341 | |
Sean Bright | fbe92dce2b | |
Naveen Albert | c930230a73 | |
Sean Bright | 05924e30f9 | |
Sean Bright | c7838a352a | |
Naveen Albert | 9211fb5e97 | |
Sean Bright | 33213c1979 | |
Sean Bright | e2e18b366c | |
Sean Bright | d3c411cd05 | |
Sean Bright | 40a9f5a88c | |
Sean Bright | 1e426b6f1c | |
George Joseph | 6ffb295c69 | |
Naveen Albert | 3be75073a9 | |
Matthew Fredrickson | b5c31b55c9 | |
Naveen Albert | 582c4645f3 | |
Naveen Albert | a6439d3723 | |
Sean Bright | da4e6e7ddb | |
George Joseph | 5a770ad13f | |
Sean Bright | 64603c4807 | |
Sean Bright | e4eeda6502 | |
George Joseph | af7e89ebf8 | |
Sean Bright | 19507ae160 | |
Naveen Albert | cdcdca5199 | |
Holger Hans Peter Freyther | 9fd2655d5a | |
Holger Hans Peter Freyther | da0b1ac1c1 | |
Brad Smith | 29a3e5660b | |
Brad Smith | 1d9c5faeb3 | |
Naveen Albert | 4a356e984c | |
Naveen Albert | 65f83311b7 | |
Mark Murawski | 6ebd820e26 | |
Naveen Albert | 95bc661542 | |
Sean Bright | baf3ce25f5 | |
George Joseph | 57d31d97dc | |
Naveen Albert | d4185ca025 | |
Mike Bradeen | e8fbdca40b | |
Sean Bright | 74a5c452de | |
Sean Bright | 3af55f14fa | |
George Joseph | 443f94b438 | |
Sean Bright | c7afd5357c | |
Samuel Olaechea | 4c507d31b9 | |
George Joseph | b9ee664440 | |
sungtae kim | 9b70b18dec | |
George Joseph | 79c5845141 | |
George Joseph | 6389654b21 | |
George Joseph | d06bb7f2fe | |
Mike Bradeen | 7ea0e3bfda | |
Holger Hans Peter Freyther | 624c7ac883 | |
Sean Bright | 8c1491dda9 | |
George Joseph | 9e9037a8aa | |
George Joseph | 29e202085d | |
George Joseph | ceddfbe7b8 | |
George Joseph | f599114ee3 | |
George Joseph | d7a6116681 | |
Mike Bradeen | 323a51fd6c | |
Naveen Albert | 5b89e40541 | |
Bastian Triller | 1cbbf36929 | |
Mike Bradeen | e921f5e010 | |
Naveen Albert | 75620616f4 | |
Eduardo | ca1ed84820 | |
George Joseph | e1050b4add | |
George Joseph | fc516f5781 | |
Tinet-mucw | a38add11e6 | |
Mike Bradeen | 4592f97c36 | |
Naveen Albert | 3b027d1e47 | |
George Joseph | 0e0f99db1d | |
Naveen Albert | f93138bcad | |
Vitezslav Novy | 56244a7371 | |
George Joseph | 71d75373f9 | |
George Joseph | 42f82d55b0 | |
Mike Bradeen | 2265eafb3a | |
Sean Bright | b952a8c38d | |
Mike Bradeen | 3759d034cc | |
George Joseph | cff637a24f | |
George Joseph | 6bd9f9ae81 | |
Maximilian Fridrich | 1af2ae177c | |
Jaco Kroon | 130c3ab792 | |
Joshua C. Colp | 182ad6926b | |
George Joseph | c457784bd0 | |
George Joseph | b68006f3a1 | |
George Joseph | c4508accc6 | |
Bastian Triller | 9284dca636 | |
George Joseph | 83964ede1f | |
Naveen Albert | c032d38d3f | |
Mike Bradeen | e9b269692f | |
George Joseph | f8438714ca | |
Naveen Albert | 9e6266e008 | |
zhengsh | eab40e755e | |
George Joseph | 644ad2f9cd | |
Maximilian Fridrich | 48e6a482c2 | |
Naveen Albert | cd0bfe193f | |
Matthew Fredrickson | 1d7ae8d227 | |
Jason D. McCormick | 2f02095da8 | |
MikeNaso | 720813dc97 | |
Sean Bright | 1171beb7e4 | |
George Joseph | 21b0522abd | |
Naveen Albert | 2179082eaf | |
George Joseph | d3ee0e6516 | |
Joshua C. Colp | a75035be55 | |
George Joseph | ea7e719d71 | |
George Joseph | 68349125a8 |
|
@ -131,7 +131,7 @@ jobs:
|
|||
github_token: ${{secrets.GITHUB_TOKEN}}
|
||||
testsuite_repo: ${{vars.TESTSUITE_REPO}}
|
||||
gatetest_group: ${{matrix.group}}
|
||||
gatetest_commands: ${{vars.GATETEST_COMMANDS}}
|
||||
gatetest_command: ${{ toJSON(fromJSON(vars.GATETEST_COMMANDS)[matrix.group]) }}
|
||||
|
||||
CherryPickGateTests:
|
||||
needs: [ IdentifyBranches, CherryPickGateTestMatrix ]
|
||||
|
|
|
@ -4,7 +4,7 @@ on:
|
|||
inputs:
|
||||
branches:
|
||||
description: "JSON array of branches: ['18','20'] (no spaces)"
|
||||
required: true
|
||||
required: false
|
||||
type: string
|
||||
schedule:
|
||||
# Times are UTC
|
||||
|
@ -14,15 +14,29 @@ env:
|
|||
ASTERISK_REPO: ${{ github.repository }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
DEFAULT_BRANCHES: ${{ vars.WIKIDOC_BRANCHES }}
|
||||
INPUT_BRANCHES: ${{ inputs.branches }}
|
||||
|
||||
jobs:
|
||||
|
||||
CreateDocsDebug:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
manual_branches: ${{ steps.setup.outputs.manual_branches }}
|
||||
steps:
|
||||
- name: setup
|
||||
run: |
|
||||
MANUAL_BRANCHES="$INPUT_BRANCHES"
|
||||
[ -z "$MANUAL_BRANCHES" ] && MANUAL_BRANCHES="$DEFAULT_BRANCHES" || :
|
||||
echo "manual_branches=${MANUAL_BRANCHES}"
|
||||
echo "manual_branches=${MANUAL_BRANCHES}" >>${GITHUB_OUTPUT}
|
||||
exit 0
|
||||
|
||||
- name: DumpEnvironment
|
||||
uses: asterisk/asterisk-ci-actions/DumpEnvironmentAction@main
|
||||
with:
|
||||
action-vars: ${{toJSON(inputs)}}
|
||||
action-inputs: ${{toJSON(inputs)}}
|
||||
action-vars: ${{ toJSON(steps.setup.outputs) }}
|
||||
|
||||
CreateDocsScheduledMatrix:
|
||||
needs: [ CreateDocsDebug ]
|
||||
|
@ -73,7 +87,7 @@ jobs:
|
|||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
branch: ${{ fromJSON(inputs.branches) }}
|
||||
branch: ${{ fromJSON(vars.WIKIDOC_MANUAL_BRANCHES) }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: CreateDocs for ${{matrix.branch}}
|
||||
|
|
|
@ -123,9 +123,6 @@ jobs:
|
|||
MergeAndCherryPick:
|
||||
needs: [ IdentifyBranches, PreMergeUnitTests ]
|
||||
if: success()
|
||||
concurrency:
|
||||
group: MergeAndCherryPick
|
||||
cancel-in-progress: false
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Start Merge
|
||||
|
@ -138,7 +135,7 @@ jobs:
|
|||
|
||||
- name: Get Token needed to push cherry-picks
|
||||
id: get_workflow_token
|
||||
uses: peter-murray/workflow-application-token-action@v1
|
||||
uses: peter-murray/workflow-application-token-action@v2
|
||||
with:
|
||||
application_id: ${{secrets.ASTERISK_ORG_ACCESS_APP_ID}}
|
||||
application_private_key: ${{secrets.ASTERISK_ORG_ACCESS_APP_PRIV_KEY}}
|
||||
|
|
|
@ -33,7 +33,7 @@ jobs:
|
|||
github_token: ${{secrets.GITHUB_TOKEN}}
|
||||
testsuite_repo: ${{vars.TESTSUITE_REPO}}
|
||||
gatetest_group: ${{matrix.group}}
|
||||
gatetest_commands: ${{vars.GATETEST_COMMANDS}}
|
||||
gatetest_command: ${{ toJSON(fromJSON(vars.GATETEST_COMMANDS)[matrix.group]) }}
|
||||
|
||||
AsteriskNightlyTests:
|
||||
if: ${{ always() }}
|
||||
|
|
|
@ -1,184 +0,0 @@
|
|||
name: PROpenedOrUpdated
|
||||
run-name: "PR ${{github.event.number}} ${{github.event.action}} by ${{ github.actor }}"
|
||||
on:
|
||||
# workflow_dispatch:
|
||||
pull_request_target:
|
||||
types: [opened, reopened, synchronize]
|
||||
|
||||
env:
|
||||
ASTERISK_REPO: ${{github.repository}}
|
||||
PR_NUMBER: ${{github.event.number}}
|
||||
PR_COMMIT: ${{github.event.pull_request.head.sha}}
|
||||
BRANCH: ${{github.event.pull_request.base.ref}}
|
||||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
||||
MODULES_BLACKLIST: ${{vars.GATETEST_MODULES_BLACKLIST}} ${{vars.UNITTEST_MODULES_BLACKLIST}}
|
||||
|
||||
jobs:
|
||||
|
||||
PROpenUpdateUnitTests:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Job Start Delay
|
||||
env:
|
||||
JOB_START_DELAY_SEC: ${{vars.PR_JOB_START_DELAY_SEC}}
|
||||
run: |
|
||||
# Give the user a chance to add their "cherry-pick-to" comments
|
||||
sleep ${JOB_START_DELAY_SEC:-60}
|
||||
|
||||
- name: Get Token needed to add reviewers
|
||||
if: github.event.action == 'opened'
|
||||
id: get_workflow_token
|
||||
uses: peter-murray/workflow-application-token-action@v1
|
||||
with:
|
||||
application_id: ${{secrets.ASTERISK_ORG_ACCESS_APP_ID}}
|
||||
application_private_key: ${{secrets.ASTERISK_ORG_ACCESS_APP_PRIV_KEY}}
|
||||
organization: asterisk
|
||||
|
||||
- name: Get cherry-pick branches
|
||||
uses: asterisk/asterisk-ci-actions/GetCherryPickBranchesFromPR@main
|
||||
id: getbranches
|
||||
with:
|
||||
repo: ${{github.repository}}
|
||||
pr_number: ${{env.PR_NUMBER}}
|
||||
cherry_pick_regex: ${{vars.CHERRY_PICK_REGEX}}
|
||||
github_token: ${{secrets.GITHUB_TOKEN}}
|
||||
|
||||
- name: Add cherry-pick reminder
|
||||
env:
|
||||
GITHUB_TOKEN: ${{steps.get_workflow_token.outputs.token}}
|
||||
GH_TOKEN: ${{steps.get_workflow_token.outputs.token}}
|
||||
CHERRY_PICK_REMINDER: ${{vars.CHERRY_PICK_REMINDER}}
|
||||
BRANCHES_OUTPUT: ${{toJSON(steps.getbranches.outputs)}}
|
||||
BRANCH_COUNT: ${{steps.getbranches.outputs.branch_count}}
|
||||
FORCED_NONE: ${{steps.getbranches.outputs.forced_none}}
|
||||
run: |
|
||||
# If the user already added "cherry-pick-to" comments
|
||||
# we don't need to remind them.
|
||||
( $FORCED_NONE || [ $BRANCH_COUNT -gt 0 ] ) && { echo "No reminder needed." ; exit 0 ; }
|
||||
IFS=$'; \n'
|
||||
# If there's already a reminder comment, don't add another one.
|
||||
ADD_COMMENT=true
|
||||
# This query will FAIL if it finds the comment.
|
||||
gh pr view --repo ${{github.repository}} --json comments \
|
||||
--jq '.comments[].body | select(. | startswith("<!--CPR-->")) | halt_error(1)' \
|
||||
${{env.PR_NUMBER}} >/dev/null 2>&1 || ADD_COMMENT=false
|
||||
if $ADD_COMMENT ; then
|
||||
echo "Adding CPR comment"
|
||||
gh pr comment --repo ${{github.repository}} \
|
||||
-b "${CHERRY_PICK_REMINDER}" ${{env.PR_NUMBER}}
|
||||
else
|
||||
echo "CPR comment already present"
|
||||
fi
|
||||
|
||||
- name: Add reviewers
|
||||
if: github.event.action == 'opened'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{steps.get_workflow_token.outputs.token}}
|
||||
GH_TOKEN: ${{steps.get_workflow_token.outputs.token}}
|
||||
CHERRY_PICK_REMINDER: ${{vars.CHERRY_PICK_REMINDER}}
|
||||
REVIEWERS: ${{vars.PR_REVIEWERS}}
|
||||
run: |
|
||||
IFS=$'; \n'
|
||||
for r in $REVIEWERS ; do
|
||||
echo "Adding reviewer $r"
|
||||
gh pr edit --repo ${{github.repository}} ${PR_NUMBER} --add-reviewer $r || :
|
||||
done
|
||||
|
||||
- name: Set Labels
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
gh pr edit --repo ${{github.repository}} \
|
||||
--remove-label ${{vars.TEST_CHECKS_PASSED_LABEL}} \
|
||||
--remove-label ${{vars.TEST_CHECKS_FAILED_LABEL}} \
|
||||
--remove-label ${{vars.TEST_GATES_PASSED_LABEL}} \
|
||||
--remove-label ${{vars.TEST_GATES_FAILED_LABEL}} \
|
||||
--remove-label ${{vars.CHERRY_PICK_CHECKS_PASSED_LABEL}} \
|
||||
--remove-label ${{vars.CHERRY_PICK_CHECKS_FAILED_LABEL}} \
|
||||
--remove-label ${{vars.CHERRY_PICK_GATES_PASSED_LABEL}} \
|
||||
--remove-label ${{vars.CHERRY_PICK_GATES_FAILED_LABEL}} \
|
||||
--add-label ${{vars.TESTING_IN_PROGRESS}} \
|
||||
${{env.PR_NUMBER}} || :
|
||||
|
||||
- name: Run Unit Tests
|
||||
uses: asterisk/asterisk-ci-actions/AsteriskUnitComposite@main
|
||||
with:
|
||||
asterisk_repo: ${{env.ASTERISK_REPO}}
|
||||
pr_number: ${{env.PR_NUMBER}}
|
||||
base_branch: ${{env.BRANCH}}
|
||||
modules_blacklist: ${{env.MODULES_BLACKLIST}}
|
||||
github_token: ${{secrets.GITHUB_TOKEN}}
|
||||
unittest_command: ${{vars.UNITTEST_COMMAND}}
|
||||
|
||||
- name: Add Checks Passed Label
|
||||
if: ${{ success() }}
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
gh pr edit --repo ${{github.repository}} \
|
||||
--add-label ${{vars.TEST_CHECKS_PASSED_LABEL}} \
|
||||
${{env.PR_NUMBER}} || :
|
||||
|
||||
PROpenUpdateGateTestMatrix:
|
||||
needs: PROpenUpdateUnitTests
|
||||
continue-on-error: false
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
group: ${{ fromJSON(vars.GATETEST_LIST) }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- id: runtest
|
||||
name: Run Gate Tests for ${{ matrix.group }}
|
||||
uses: asterisk/asterisk-ci-actions/AsteriskGateComposite@main
|
||||
with:
|
||||
test_type: Gate
|
||||
asterisk_repo: ${{env.ASTERISK_REPO}}
|
||||
pr_number: ${{env.PR_NUMBER}}
|
||||
base_branch: ${{env.BRANCH}}
|
||||
modules_blacklist: ${{env.MODULES_BLACKLIST}}
|
||||
github_token: ${{secrets.GITHUB_TOKEN}}
|
||||
testsuite_repo: ${{vars.TESTSUITE_REPO}}
|
||||
gatetest_group: ${{matrix.group}}
|
||||
gatetest_commands: ${{vars.GATETEST_COMMANDS}}
|
||||
|
||||
|
||||
PROpenUpdateGateTests:
|
||||
if: always()
|
||||
runs-on: ubuntu-latest
|
||||
needs: PROpenUpdateGateTestMatrix
|
||||
steps:
|
||||
- name: Check test matrix status
|
||||
env:
|
||||
RESULT: ${{ needs.PROpenUpdateGateTestMatrix.result }}
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
echo "all results: ${{ toJSON(needs.*.result) }}"
|
||||
echo "composite result: $RESULT"
|
||||
|
||||
gh pr edit --repo ${{github.repository}} \
|
||||
--remove-label ${{vars.TESTING_IN_PROGRESS}} \
|
||||
${{env.PR_NUMBER}} || :
|
||||
|
||||
case $RESULT in
|
||||
success)
|
||||
gh pr edit --repo ${{github.repository}} \
|
||||
--add-label ${{vars.TEST_GATES_PASSED_LABEL}} \
|
||||
${{env.PR_NUMBER}} || :
|
||||
echo "::notice::All Testsuite tests passed"
|
||||
exit 0
|
||||
;;
|
||||
skipped)
|
||||
gh pr edit --repo ${{github.repository}} \
|
||||
--add-label ${{vars.TEST_CHECKS_FAILED_LABEL}} \
|
||||
${{env.PR_NUMBER}} || :
|
||||
echo "::error::Testsuite tests were skipped because of an earlier failure"
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
gh pr edit --repo ${{github.repository}} \
|
||||
--add-label ${{vars.TEST_GATES_FAILED_LABEL}} \
|
||||
${{env.PR_NUMBER}} || :
|
||||
echo "::error::One or more Testsuite tests failed ($RESULT)"
|
||||
exit 1
|
||||
esac
|
|
@ -0,0 +1,149 @@
|
|||
name: PRSubmitActions
|
||||
run-name: "PRSubmitActions: Test ${{github.event.action}}"
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: [PRSubmitTests]
|
||||
types:
|
||||
- requested
|
||||
- completed
|
||||
env:
|
||||
ACTION: ${{ github.event.action }}
|
||||
CONCLUSION: ${{ github.event.workflow_run.conclusion }}
|
||||
REPO: ${{ github.repository }}
|
||||
|
||||
jobs:
|
||||
PRSubmitActions:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Get PR Number
|
||||
id: getpr
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
retries: 5
|
||||
script: |
|
||||
let search = `repo:${context.repo.owner}/${context.repo.repo} ${context.payload.workflow_run.head_sha}`;
|
||||
let prs = await github.rest.search.issuesAndPullRequests({
|
||||
q: search,
|
||||
});
|
||||
if (prs.data.total_count == 0) {
|
||||
core.setFailed(`Unable to get PR for ${context.payload.workflow_run.head_sha}`);
|
||||
return;
|
||||
}
|
||||
let pr_number = prs.data.items[0].number;
|
||||
core.setOutput('pr_number', pr_number);
|
||||
return;
|
||||
|
||||
- name: Set Label
|
||||
id: setlabel
|
||||
uses: actions/github-script@v7
|
||||
env:
|
||||
PR_NUMBER: ${{ steps.getpr.outputs.PR_NUMBER }}
|
||||
LABEL_TIP: ${{ vars.PR_SUBMIT_TESTING_IN_PROGRESS }}
|
||||
LABEL_PASS: ${{ vars.PR_SUBMIT_TESTS_PASSED }}
|
||||
LABEL_FAIL: ${{ vars.PR_SUBMIT_TESTS_FAILED }}
|
||||
with:
|
||||
retries: 5
|
||||
script: |
|
||||
let label;
|
||||
if (process.env.ACTION === 'requested') {
|
||||
label = process.env.LABEL_TIP;
|
||||
} else {
|
||||
if ( process.env.CONCLUSION === 'success' ) {
|
||||
label = process.env.LABEL_PASS;
|
||||
} else {
|
||||
label = process.env.LABEL_FAIL;
|
||||
}
|
||||
}
|
||||
core.info(`Setting label ${label}`);
|
||||
github.rest.issues.setLabels({
|
||||
issue_number: process.env.PR_NUMBER,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
labels: [ label ]
|
||||
});
|
||||
return;
|
||||
|
||||
- name: Get cherry-pick branches
|
||||
if: github.event.action == 'completed'
|
||||
id: getbranches
|
||||
uses: asterisk/asterisk-ci-actions/GetCherryPickBranchesFromPR@main
|
||||
with:
|
||||
repo: ${{env.REPO}}
|
||||
pr_number: ${{steps.getpr.outputs.PR_NUMBER}}
|
||||
cherry_pick_regex: ${{vars.CHERRY_PICK_REGEX}}
|
||||
github_token: ${{secrets.GITHUB_TOKEN}}
|
||||
|
||||
- name: Add cherry-pick reminder
|
||||
if: github.event.action == 'completed'
|
||||
uses: actions/github-script@v7
|
||||
env:
|
||||
PR_NUMBER: ${{steps.getpr.outputs.PR_NUMBER}}
|
||||
CHERRY_PICK_REMINDER: ${{vars.CHERRY_PICK_REMINDER}}
|
||||
BRANCHES_OUTPUT: ${{toJSON(steps.getbranches.outputs)}}
|
||||
BRANCH_COUNT: ${{steps.getbranches.outputs.branch_count}}
|
||||
FORCED_NONE: ${{steps.getbranches.outputs.forced_none}}
|
||||
with:
|
||||
retries: 5
|
||||
script: |
|
||||
if (process.env.FORCED_NONE === 'true' ||
|
||||
process.env.BRANCH_COUNT > 0) {
|
||||
core.info("No cherry-pick reminder needed.");
|
||||
return;
|
||||
}
|
||||
let comments = await github.rest.issues.listComments({
|
||||
issue_number: process.env.PR_NUMBER,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
});
|
||||
let found = false;
|
||||
for (const c of comments.data) {
|
||||
if (c.body.startsWith("<!--CPR-->")) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found) {
|
||||
core.info("Cherry-pick reminder already exists.");
|
||||
return;
|
||||
}
|
||||
core.info("Adding cherry-pick reminder.");
|
||||
await github.rest.issues.createComment({
|
||||
issue_number: process.env.PR_NUMBER,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: process.env.CHERRY_PICK_REMINDER
|
||||
})
|
||||
return;
|
||||
|
||||
- name: Add reviewers
|
||||
if: github.event.action == 'completed'
|
||||
uses: actions/github-script@v7
|
||||
env:
|
||||
PR_NUMBER: ${{steps.getpr.outputs.PR_NUMBER}}
|
||||
REVIEWERS: ${{vars.PR_REVIEWERS}}
|
||||
with:
|
||||
retries: 5
|
||||
github-token: ${{ secrets.ASTERISKTEAM_PAT }}
|
||||
script: |
|
||||
let rs = JSON.parse(process.env.REVIEWERS.length ? process.env.REVIEWERS : '[]');
|
||||
let users = [];
|
||||
let teams = [];
|
||||
for (const r of rs) {
|
||||
if (r.indexOf("/") > 0) {
|
||||
teams.push(r.split('/')[1]);
|
||||
} else {
|
||||
users.push(r);
|
||||
}
|
||||
}
|
||||
if (teams.length > 0 || users.length > 0) {
|
||||
core.info(`Adding user reviewers ${users}`);
|
||||
core.info(`Adding team reviewers ${teams}`);
|
||||
await github.rest.pulls.requestReviewers({
|
||||
pull_number: process.env.PR_NUMBER,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
reviewers: users,
|
||||
team_reviewers: teams
|
||||
});
|
||||
}
|
||||
return;
|
|
@ -0,0 +1,114 @@
|
|||
name: PRSubmitTests
|
||||
run-name: "PR ${{github.event.number}} ${{github.event.action}} by ${{ github.actor }}"
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, reopened, synchronize]
|
||||
|
||||
concurrency:
|
||||
group: ${{github.workflow}}-${{github.event.number}}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
ASTERISK_REPO: ${{github.repository}}
|
||||
PR_NUMBER: ${{github.event.number}}
|
||||
PR_COMMIT: ${{github.event.pull_request.head.sha}}
|
||||
BRANCH: ${{github.event.pull_request.base.ref}}
|
||||
|
||||
jobs:
|
||||
#
|
||||
# Pull requests created from forked respositories don't have access to
|
||||
# the "Action Variables" ('vars' context) so we need to retrieve control
|
||||
# data from an action.
|
||||
#
|
||||
PRSGetControlData:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
control_data: ${{ steps.setvars.outputs.control_data }}
|
||||
steps:
|
||||
- id: setvars
|
||||
uses: asterisk/asterisk-ci-actions/GetRepoControlData@main
|
||||
with:
|
||||
repo: ${{ github.event.repository.name}}
|
||||
- name: DumpEnvironment
|
||||
uses: asterisk/asterisk-ci-actions/DumpEnvironmentAction@main
|
||||
with:
|
||||
action-inputs: ${{toJSON(inputs)}}
|
||||
action-vars: ${{ toJSON(steps.setvars.outputs) }}
|
||||
|
||||
PRSUnitTests:
|
||||
needs: PRSGetControlData
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
UNITTEST_COMMAND: ${{ fromJSON(needs.PRSGetControlData.outputs.control_data).UNITTEST_COMMAND }}
|
||||
steps:
|
||||
- name: Run Unit Tests
|
||||
uses: asterisk/asterisk-ci-actions/AsteriskUnitComposite@main
|
||||
with:
|
||||
asterisk_repo: ${{env.ASTERISK_REPO}}
|
||||
pr_number: ${{env.PR_NUMBER}}
|
||||
base_branch: ${{env.BRANCH}}
|
||||
unittest_command: ${{env.UNITTEST_COMMAND}}
|
||||
|
||||
PRSGateTestMatrix:
|
||||
runs-on: ubuntu-latest
|
||||
needs: PRSGetControlData
|
||||
continue-on-error: false
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
group: ${{ fromJSON(fromJSON(needs.PRSGetControlData.outputs.control_data).GATETEST_LIST) }}
|
||||
env:
|
||||
TESTSUITE_REPO: "${{ fromJSON(needs.PRSGetControlData.outputs.control_data).TESTSUITE_REPO }}"
|
||||
GATETEST_COMMANDS: "${{ fromJSON(needs.PRSGetControlData.outputs.control_data).GATETEST_COMMANDS }}"
|
||||
GATETEST_COMMAND: "${{ toJSON(fromJSON(fromJSON(needs.PRSGetControlData.outputs.control_data).GATETEST_COMMANDS)[matrix.group]) }}"
|
||||
steps:
|
||||
- id: runtest
|
||||
name: Run Gate Tests for ${{ matrix.group }}
|
||||
uses: asterisk/asterisk-ci-actions/AsteriskGateComposite@main
|
||||
with:
|
||||
test_type: Gate
|
||||
asterisk_repo: ${{env.ASTERISK_REPO}}
|
||||
pr_number: ${{env.PR_NUMBER}}
|
||||
base_branch: ${{env.BRANCH}}
|
||||
testsuite_repo: ${{env.TESTSUITE_REPO}}
|
||||
gatetest_group: ${{matrix.group}}
|
||||
gatetest_command: ${{env.GATETEST_COMMAND}}
|
||||
|
||||
PRSTestResults:
|
||||
if: always()
|
||||
runs-on: ubuntu-latest
|
||||
needs: [PRSUnitTests,PRSGateTestMatrix]
|
||||
steps:
|
||||
- name: Check test matrix status
|
||||
env:
|
||||
RESULT_UNIT: ${{ needs.PRSUnitTests.result }}
|
||||
RESULT_GATE: ${{ needs.PRSGateTestMatrix.result }}
|
||||
run: |
|
||||
declare -i rc=0
|
||||
echo "all results: ${{ toJSON(needs.*.result) }}"
|
||||
case $RESULT_UNIT in
|
||||
success)
|
||||
echo "::notice::Unit tests passed"
|
||||
;;
|
||||
skipped)
|
||||
echo "::error::Unit tests were skipped because of an earlier failure"
|
||||
rc+=1
|
||||
;;
|
||||
*)
|
||||
echo "::error::One or more unit tests failed ($RESULT_UNIT)"
|
||||
rc+=1
|
||||
esac
|
||||
case $RESULT_GATE in
|
||||
success)
|
||||
echo "::notice::Gate tests passed"
|
||||
;;
|
||||
skipped)
|
||||
echo "::error::Gate tests were skipped because of an earlier failure"
|
||||
rc+=1
|
||||
;;
|
||||
*)
|
||||
echo "::error::One or more gate tests failed ($RESULT_GATE)"
|
||||
rc+=1
|
||||
esac
|
||||
echo "::notice::Final result code: $rc"
|
||||
exit $rc
|
|
@ -1,6 +1,5 @@
|
|||
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
|
||||
name: Asterisk Release
|
||||
run-name: ${{ github.actor }} is creating Asterisk release ${{inputs.new_version}}
|
||||
name: Releaser
|
||||
run-name: ${{ github.actor }} is creating ${{vars.PRODUCT_NAME}} release ${{inputs.new_version}}
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
|
@ -12,13 +11,6 @@ on:
|
|||
certified-20.4-cert1-rc1, certified-20.4-cert1
|
||||
required: true
|
||||
type: string
|
||||
# start_version:
|
||||
# description: |
|
||||
# Last Version:
|
||||
# Only use when you KNOW that the automated
|
||||
# process won't get it right.
|
||||
# required: false
|
||||
# type: string
|
||||
is_security:
|
||||
description: |
|
||||
Security?
|
||||
|
@ -40,6 +32,12 @@ on:
|
|||
required: true
|
||||
type: boolean
|
||||
default: false
|
||||
force_cherry_pick:
|
||||
description: |
|
||||
Force cherry-pick for non-RC1 releases? USE WITH CAUTION!
|
||||
required: true
|
||||
type: boolean
|
||||
default: false
|
||||
push_release_branches:
|
||||
description: |
|
||||
Push release branches live?
|
||||
|
@ -70,31 +68,32 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Run Releaser
|
||||
uses: asterisk/asterisk-ci-actions/AsteriskReleaserComposite@main
|
||||
uses: asterisk/asterisk-ci-actions/ReleaserComposite@main
|
||||
with:
|
||||
product: ${{vars.PRODUCT_NAME}}
|
||||
is_security: ${{inputs.is_security}}
|
||||
advisories: ${{inputs.advisories}}
|
||||
is_hotfix: ${{inputs.is_hotfix}}
|
||||
new_version: ${{inputs.new_version}}
|
||||
# start_version: ${{inputs.start_version}}
|
||||
force_cherry_pick: ${{inputs.force_cherry_pick}}
|
||||
push_release_branches: ${{inputs.push_release_branches}}
|
||||
create_github_release: ${{inputs.create_github_release}}
|
||||
push_tarballs: ${{inputs.push_tarballs}}
|
||||
send_email: ${{inputs.send_email}}
|
||||
repo: ${{github.repository}}
|
||||
asterisk_mail_list_ga: ${{vars.ASTERISK_MAIL_LIST_GA}}
|
||||
asterisk_mail_list_rc: ${{vars.ASTERISK_MAIL_LIST_RC}}
|
||||
asterisk_mail_list_cert_ga: ${{vars.ASTERISK_MAIL_LIST_CERT_GA}}
|
||||
asterisk_mail_list_cert_rc: ${{vars.ASTERISK_MAIL_LIST_CERT_RC}}
|
||||
asterisk_mail_list_sec: ${{vars.ASTERISK_MAIL_LIST_SEC_ADV}}
|
||||
sec_adv_url_base: ${{vars.ASTERISK_SEC_ADV_URL_BASE}}
|
||||
mail_list_ga: ${{vars.MAIL_LIST_GA}}
|
||||
mail_list_rc: ${{vars.MAIL_LIST_RC}}
|
||||
mail_list_cert_ga: ${{vars.MAIL_LIST_CERT_GA}}
|
||||
mail_list_cert_rc: ${{vars.MAIL_LIST_CERT_RC}}
|
||||
mail_list_sec: ${{vars.MAIL_LIST_SEC_ADV}}
|
||||
sec_adv_url_base: ${{vars.SEC_ADV_URL_BASE}}
|
||||
gpg_private_key: ${{secrets.ASTDEV_GPG_PRIV_KEY}}
|
||||
github_token: ${{secrets.GITHUB_TOKEN}}
|
||||
application_id: ${{secrets.ASTERISK_ORG_ACCESS_APP_ID}}
|
||||
application_private_key: ${{secrets.ASTERISK_ORG_ACCESS_APP_PRIV_KEY}}
|
||||
asteriskteamsa_username: ${{secrets.ASTERISKTEAMSA_GMAIL_ACCT}}
|
||||
asteriskteamsa_token: ${{secrets.ASTERISKTEAMSA_GMAIL_TOKEN}}
|
||||
deploy_ssh_priv_key: ${{secrets.ASTERISK_DEPLOY_SSH_PRIV_KEY}}
|
||||
deploy_ssh_username: ${{secrets.ASTERISK_DEPLOY_SSH_USERNAME}}
|
||||
deploy_host: ${{vars.ASTERISK_DEPLOY_HOST}}
|
||||
deploy_dir: ${{vars.ASTERISK_DEPLOY_DIR}}
|
||||
deploy_ssh_priv_key: ${{secrets.DOWNLOADS_DEPLOY_SSH_PRIV_KEY}}
|
||||
deploy_ssh_username: ${{secrets.DOWNLOADS_DEPLOY_SSH_USERNAME}}
|
||||
deploy_host: ${{vars.DEPLOY_HOST}}
|
||||
deploy_dir: ${{vars.DEPLOY_DIR}}
|
2
BUGS
2
BUGS
|
@ -10,7 +10,7 @@ For more information on using the bug tracker, or to
|
|||
learn how you can contribute by acting as a bug marshal
|
||||
please see:
|
||||
|
||||
https://wiki.asterisk.org/wiki/x/RgAtAQ
|
||||
https://docs.asterisk.org/Asterisk-Community/Asterisk-Issue-Guidelines/
|
||||
|
||||
If you would like to submit a feature request, please
|
||||
resist the temptation to post it to the bug tracker.
|
||||
|
|
6
Makefile
6
Makefile
|
@ -377,7 +377,7 @@ $(MOD_SUBDIRS_MENUSELECT_TREE):
|
|||
+@$(SUBMAKE) -C $(@:-menuselect-tree=) SUBDIR=$(@:-menuselect-tree=) moduleinfo
|
||||
+@$(SUBMAKE) -C $(@:-menuselect-tree=) SUBDIR=$(@:-menuselect-tree=) makeopts
|
||||
|
||||
$(SUBDIRS): makeopts .lastclean main/version.c include/asterisk/build.h include/asterisk/buildopts.h defaults.h
|
||||
$(SUBDIRS): makeopts .lastclean main/version.c include/asterisk/build.h defaults.h
|
||||
|
||||
ifeq ($(findstring $(OSARCH), mingw32 cygwin ),)
|
||||
main: third-party
|
||||
|
@ -403,7 +403,7 @@ defaults.h: makeopts .lastclean build_tools/make_defaults_h
|
|||
@cmp -s $@.tmp $@ || mv $@.tmp $@
|
||||
@rm -f $@.tmp
|
||||
|
||||
main/version.c: FORCE menuselect.makeopts .lastclean
|
||||
main/version.c: FORCE include/asterisk/buildopts.h menuselect.makeopts .lastclean
|
||||
@build_tools/make_version_c > $@.tmp
|
||||
@cmp -s $@.tmp $@ || mv $@.tmp $@
|
||||
@rm -f $@.tmp
|
||||
|
@ -545,7 +545,7 @@ INSTALLDIRS="$(ASTLIBDIR)" "$(ASTMODDIR)" "$(ASTSBINDIR)" "$(ASTCACHEDIR)" "$(AS
|
|||
"$(ASTDATADIR)/firmware/iax" "$(ASTDATADIR)/images" "$(ASTDATADIR)/keys" \
|
||||
"$(ASTDATADIR)/phoneprov" "$(ASTDATADIR)/rest-api" "$(ASTDATADIR)/static-http" \
|
||||
"$(ASTDATADIR)/sounds" "$(ASTDATADIR)/moh" "$(ASTMANDIR)/man8" "$(AGI_DIR)" "$(ASTDBDIR)" \
|
||||
"$(ASTDATADIR)/third-party" "${ASTDATADIR}/keys/stir_shaken"
|
||||
"$(ASTDATADIR)/third-party" "${ASTDATADIR}/keys/stir_shaken" "${ASTDATADIR}/keys/stir_shaken/cache"
|
||||
|
||||
installdirs:
|
||||
@for i in $(INSTALLDIRS); do \
|
||||
|
|
|
@ -379,9 +379,8 @@ is set to no.
|
|||
|
||||
In Asterisk 12 and later, live_dangerously defaults to no.
|
||||
|
||||
|
||||
[voip-security-webinar]: https://www.asterisk.org/security/webinar/
|
||||
[blog-sip-security]: http://blogs.digium.com/2009/03/28/sip-security/
|
||||
[voip-security-webinar]: https://docs.asterisk.org/Deployment/Important-Security-Considerations/Asterisk-Security-Webinars/
|
||||
[blog-sip-security]: https://web.archive.org/web/20171030134647/http://blogs.digium.com/2009/03/28/sip-security/
|
||||
[Strong Password Generator]: https://www.strongpasswordgenerator.com
|
||||
[Filtering Data]: #filtering-data
|
||||
[Proper Device Naming]: #proper-device-naming
|
||||
|
@ -389,4 +388,4 @@ In Asterisk 12 and later, live_dangerously defaults to no.
|
|||
[Reducing Pattern Match Typos]: #reducing-pattern-match-typos
|
||||
[Manager Class Authorizations]: #manager-class-authorizations
|
||||
[Avoid Privilege Escalations]: #avoid-privilege-escalations
|
||||
[Important Security Considerations]: https://wiki.asterisk.org/wiki/display/AST/Important+Security+Considerations
|
||||
[Important Security Considerations]: https://docs.asterisk.org/Deployment/Important-Security-Considerations/
|
||||
|
|
|
@ -20,7 +20,7 @@ more telephony interfaces than just Internet telephony. Asterisk also has a
|
|||
vast amount of support for traditional PSTN telephony, as well.
|
||||
|
||||
For more information on the project itself, please visit the Asterisk
|
||||
[home page] and the official [wiki]. In addition you'll find lots
|
||||
[home page] and the official [documentation]. In addition you'll find lots
|
||||
of information compiled by the Asterisk community at [voip-info.org].
|
||||
|
||||
There is a book on Asterisk published by O'Reilly under the Creative Commons
|
||||
|
@ -48,7 +48,7 @@ ANY special hardware, not even a sound card) to install and run Asterisk.
|
|||
|
||||
Supported telephony hardware includes:
|
||||
* All Analog and Digital Interface cards from [Sangoma]
|
||||
* QuickNet Internet PhoneJack and LineJack (http://www.quicknet.net)
|
||||
* QuickNet Internet PhoneJack and LineJack
|
||||
* any full duplex sound card supported by ALSA, OSS, or PortAudio
|
||||
* any ISDN card supported by mISDN on Linux
|
||||
* The Xorcom Astribank channel bank
|
||||
|
@ -258,7 +258,7 @@ Asterisk is a trademark of Sangoma Technologies Corporation
|
|||
|
||||
[home page]: https://www.asterisk.org
|
||||
[support]: https://www.asterisk.org/support
|
||||
[wiki]: https://wiki.asterisk.org/
|
||||
[documentation]: https://docs.asterisk.org/
|
||||
[mailing list]: http://lists.digium.com/mailman/listinfo/asterisk-users
|
||||
[chan_dahdi.conf]: configs/samples/chan_dahdi.conf.sample
|
||||
[voip-info.org]: http://www.voip-info.org/wiki-Asterisk
|
||||
|
@ -269,4 +269,4 @@ Asterisk is a trademark of Sangoma Technologies Corporation
|
|||
[CHANGES]: CHANGES
|
||||
[configs]: configs
|
||||
[doc]: doc
|
||||
[Important Security Considerations]: https://wiki.asterisk.org/wiki/display/AST/Important+Security+Considerations
|
||||
[Important Security Considerations]: https://docs.asterisk.org/Deployment/Important-Security-Considerations/
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
## Supported Versions
|
||||
|
||||
The Asterisk project maintains a [wiki page](https://wiki.asterisk.org/wiki/display/AST/Asterisk+Versions) of releases. Each version is listed with its release date, security fix only date, and end of life date. Consult this wiki page to see if the version of Asterisk you are reporting a security vulnerability against is still supported.
|
||||
The Asterisk project maintains a [documentation page](https://docs.asterisk.org/About-the-Project/Asterisk-Versions/) of releases. Each version is listed with its release date, security fix only date, and end of life date. Consult this wiki page to see if the version of Asterisk you are reporting a security vulnerability against is still supported.
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
|
|
2986
UPGRADE.txt
2986
UPGRADE.txt
File diff suppressed because it is too large
Load Diff
|
@ -84,7 +84,7 @@ struct mysql_conn {
|
|||
AST_RWLIST_ENTRY(mysql_conn) list;
|
||||
ast_mutex_t lock;
|
||||
MYSQL handle;
|
||||
char host[50];
|
||||
char host[MAXHOSTNAMELEN];
|
||||
char name[50];
|
||||
char user[50];
|
||||
char pass[50];
|
||||
|
|
|
@ -567,7 +567,7 @@ static int load_config(int reload)
|
|||
|
||||
ast_config_destroy(cfg);
|
||||
|
||||
ast_verb(3, "AMD defaults: initialSilence [%d] greeting [%d] afterGreetingSilence [%d] "
|
||||
ast_verb(5, "AMD defaults: initialSilence [%d] greeting [%d] afterGreetingSilence [%d] "
|
||||
"totalAnalysisTime [%d] minimumWordLength [%d] betweenWordsSilence [%d] maximumNumberOfWords [%d] silenceThreshold [%d] maximumWordLength [%d]\n",
|
||||
dfltInitialSilence, dfltGreeting, dfltAfterGreetingSilence, dfltTotalAnalysisTime,
|
||||
dfltMinimumWordLength, dfltBetweenWordsSilence, dfltMaximumNumberOfWords, dfltSilenceThreshold, dfltMaximumWordLength);
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
</syntax>
|
||||
<description>
|
||||
<para>Connects to the given TCP service, then transmits channel audio over that socket. In turn, audio is received from the socket and sent to the channel. Only audio frames will be transmitted.</para>
|
||||
<para>Protocol is specified at https://wiki.asterisk.org/wiki/display/AST/AudioSocket</para>
|
||||
<para>Protocol is specified at https://docs.asterisk.org/Configuration/Channel-Drivers/AudioSocket/</para>
|
||||
<para>This application does not automatically answer and should generally be preceeded by an application such as Answer() or Progress().</para>
|
||||
</description>
|
||||
</application>
|
||||
|
@ -180,7 +180,7 @@ static int audiosocket_run(struct ast_channel *chan, const char *id, int svc)
|
|||
chanName = ast_channel_name(chan);
|
||||
|
||||
while (1) {
|
||||
|
||||
ms = -1;
|
||||
targetChan = ast_waitfor_nandfds(&chan, 1, &svc, 1, NULL, &outfd, &ms);
|
||||
if (targetChan) {
|
||||
f = ast_read(chan);
|
||||
|
|
|
@ -95,8 +95,17 @@ static const char app[] = "Authenticate";
|
|||
maxdigits have been entered (without requiring the user to press the <literal>#</literal> key).
|
||||
Defaults to 0 - no limit - wait for the user press the <literal>#</literal> key.</para>
|
||||
</parameter>
|
||||
<parameter name="prompt" required="false">
|
||||
<para>Override the agent-pass prompt file.</para>
|
||||
<parameter name="prompt" required="false" argsep="&">
|
||||
<para>Override the "agent-pass" sound file. Can be
|
||||
an ampersand separated list of filenames. If the filename
|
||||
is a relative filename (it does not begin with a slash), it
|
||||
will be searched for in the Asterisk sounds directory. If the
|
||||
filename is able to be parsed as a URL, Asterisk will
|
||||
download the file and then begin playback on it. To include a
|
||||
literal <literal>&</literal> in the URL you can enclose
|
||||
the URL in single quotes.</para>
|
||||
<argument name="prompt" required="true" />
|
||||
<argument name="prompt2" multiple="true" />
|
||||
</parameter>
|
||||
</syntax>
|
||||
<description>
|
||||
|
|
|
@ -117,6 +117,7 @@ static int chanavail_exec(struct ast_channel *chan, const char *data)
|
|||
struct ast_str *tmp_availcause = ast_str_alloca(2048);
|
||||
struct ast_channel *tempchan;
|
||||
struct ast_custom_function *cdr_prop_func = ast_custom_function_find("CDR_PROP");
|
||||
struct ast_format_cap *caps = NULL;
|
||||
AST_DECLARE_APP_ARGS(args,
|
||||
AST_APP_ARG(reqchans);
|
||||
AST_APP_ARG(options);
|
||||
|
@ -126,6 +127,10 @@ static int chanavail_exec(struct ast_channel *chan, const char *data)
|
|||
|
||||
AST_STANDARD_APP_ARGS(args, info);
|
||||
|
||||
ao2_lock(chan);
|
||||
caps = ao2_bump(ast_channel_nativeformats(chan));
|
||||
ao2_unlock(chan);
|
||||
|
||||
if (args.options) {
|
||||
if (strchr(args.options, 'a')) {
|
||||
option_all_avail = 1;
|
||||
|
@ -174,10 +179,11 @@ static int chanavail_exec(struct ast_channel *chan, const char *data)
|
|||
snprintf(trychan, sizeof(trychan), "%s/%s", tech, number);
|
||||
status = inuse = ast_device_state(trychan);
|
||||
}
|
||||
ast_str_append(&tmp_availstat, 0, "%s%d",
|
||||
ast_str_strlen(tmp_availstat) ? "&" : "", status);
|
||||
ast_str_append(&tmp_availstat, 0, "%s%d", ast_str_strlen(tmp_availstat) ? "&" : "", status);
|
||||
|
||||
if ((inuse <= (int) AST_DEVICE_NOT_INUSE)
|
||||
&& (tempchan = ast_request(tech, ast_channel_nativeformats(chan), NULL, chan, number, &status))) {
|
||||
&& (tempchan = ast_request(tech, caps, NULL, chan, number, &status))) {
|
||||
|
||||
ast_str_append(&tmp_availchan, 0, "%s%s",
|
||||
ast_str_strlen(tmp_availchan) ? "&" : "", ast_channel_name(tempchan));
|
||||
|
||||
|
@ -199,8 +205,11 @@ static int chanavail_exec(struct ast_channel *chan, const char *data)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ao2_cleanup(caps);
|
||||
|
||||
pbx_builtin_setvar_helper(chan, "AVAILCHAN", ast_str_buffer(tmp_availchan));
|
||||
/* Store the originally used channel too */
|
||||
pbx_builtin_setvar_helper(chan, "AVAILORIGCHAN", ast_str_buffer(tmp_availorig));
|
||||
|
|
|
@ -245,6 +245,11 @@
|
|||
</enum>
|
||||
</enumlist>
|
||||
</option>
|
||||
<option name="D">
|
||||
<para>Interleave the audio coming from the channel and the audio coming to the channel in
|
||||
the output audio as a dual channel stream, rather than mix it. Does nothing if 'o'
|
||||
is also set.</para>
|
||||
</option>
|
||||
<option name="e">
|
||||
<argument name="ext" required="true" />
|
||||
<para>Enable <emphasis>enforced</emphasis> mode, so the spying channel can
|
||||
|
@ -393,6 +398,7 @@ enum {
|
|||
OPTION_EXITONHANGUP = (1 << 18), /* Hang up when the spied-on channel hangs up. */
|
||||
OPTION_UNIQUEID = (1 << 19), /* The chanprefix is a channel uniqueid or fully specified channel name. */
|
||||
OPTION_LONG_QUEUE = (1 << 20), /* Allow usage of a long queue to store audio frames. */
|
||||
OPTION_INTERLEAVED = (1 << 21), /* Interleave the Read and Write frames in the output frame. */
|
||||
};
|
||||
|
||||
enum {
|
||||
|
@ -411,6 +417,7 @@ AST_APP_OPTIONS(spy_opts, {
|
|||
AST_APP_OPTION('B', OPTION_BARGE),
|
||||
AST_APP_OPTION_ARG('c', OPTION_DTMF_CYCLE, OPT_ARG_CYCLE),
|
||||
AST_APP_OPTION('d', OPTION_DTMF_SWITCH_MODES),
|
||||
AST_APP_OPTION('D', OPTION_INTERLEAVED),
|
||||
AST_APP_OPTION_ARG('e', OPTION_ENFORCED, OPT_ARG_ENFORCED),
|
||||
AST_APP_OPTION('E', OPTION_EXITONHANGUP),
|
||||
AST_APP_OPTION_ARG('g', OPTION_GROUP, OPT_ARG_GROUP),
|
||||
|
@ -471,6 +478,56 @@ static int spy_generate(struct ast_channel *chan, void *data, int len, int sampl
|
|||
if (ast_test_flag(&csth->flags, OPTION_READONLY)) {
|
||||
/* Option 'o' was set, so don't mix channel audio */
|
||||
f = ast_audiohook_read_frame(&csth->spy_audiohook, samples, AST_AUDIOHOOK_DIRECTION_READ, ast_format_slin);
|
||||
} else if (ast_test_flag(&csth->flags, OPTION_INTERLEAVED)) {
|
||||
/* Option 'D' was set, so mix the spy frame as an interleaved dual channel frame. */
|
||||
int i;
|
||||
struct ast_frame *fr_read = NULL;
|
||||
struct ast_frame *fr_write = NULL;
|
||||
short read_buf[samples];
|
||||
short write_buf[samples];
|
||||
short stereo_buf[samples * 2];
|
||||
struct ast_frame stereo_frame = {
|
||||
.frametype = AST_FRAME_VOICE,
|
||||
.datalen = sizeof(stereo_buf),
|
||||
.samples = samples,
|
||||
};
|
||||
|
||||
f = ast_audiohook_read_frame_all(&csth->spy_audiohook, samples, ast_format_slin, &fr_read, &fr_write);
|
||||
if (f) {
|
||||
ast_frame_free(f, 0);
|
||||
f = NULL;
|
||||
}
|
||||
|
||||
if (fr_read) {
|
||||
memcpy(read_buf, fr_read->data.ptr, sizeof(read_buf));
|
||||
} else {
|
||||
/* silent out the output frame if we can't read the input */
|
||||
memset(read_buf, 0, sizeof(read_buf));
|
||||
}
|
||||
|
||||
if (fr_write) {
|
||||
memcpy(write_buf, fr_write->data.ptr, sizeof(write_buf));
|
||||
} else {
|
||||
memset(write_buf, 0, sizeof(write_buf));
|
||||
}
|
||||
|
||||
for (i = 0; i < samples; i++) {
|
||||
stereo_buf[i*2] = read_buf[i];
|
||||
stereo_buf[i*2+1] = write_buf[i];
|
||||
}
|
||||
|
||||
stereo_frame.data.ptr = stereo_buf;
|
||||
stereo_frame.subclass.format = ast_format_cache_get_slin_by_rate(samples);
|
||||
|
||||
f = ast_frdup(&stereo_frame);
|
||||
|
||||
if (fr_read) {
|
||||
ast_frame_free(fr_read, 0);
|
||||
}
|
||||
if (fr_write) {
|
||||
ast_frame_free(fr_write, 0);
|
||||
}
|
||||
|
||||
} else {
|
||||
f = ast_audiohook_read_frame(&csth->spy_audiohook, samples, AST_AUDIOHOOK_DIRECTION_BOTH, ast_format_slin);
|
||||
}
|
||||
|
|
|
@ -3035,7 +3035,7 @@ static int action_playback(struct ast_bridge_channel *bridge_channel, const char
|
|||
char *file_copy = ast_strdupa(playback_file);
|
||||
char *file = NULL;
|
||||
|
||||
while ((file = strsep(&file_copy, "&"))) {
|
||||
while ((file = ast_strsep(&file_copy, '&', AST_STRSEP_STRIP | AST_STRSEP_TRIM))) {
|
||||
if (ast_stream_and_wait(bridge_channel->chan, file, "")) {
|
||||
ast_log(LOG_WARNING, "Failed to playback file %s to channel\n", file);
|
||||
return -1;
|
||||
|
@ -3059,7 +3059,7 @@ static int action_playback_and_continue(struct confbridge_conference *conference
|
|||
char *file_copy = ast_strdupa(playback_file);
|
||||
char *file = NULL;
|
||||
|
||||
while ((file = strsep(&file_copy, "&"))) {
|
||||
while ((file = ast_strsep(&file_copy, '&', AST_STRSEP_STRIP | AST_STRSEP_TRIM))) {
|
||||
if (ast_streamfile(bridge_channel->chan, file, ast_channel_language(bridge_channel->chan))) {
|
||||
ast_log(LOG_WARNING, "Failed to playback file %s to channel\n", file);
|
||||
return -1;
|
||||
|
|
132
apps/app_dial.c
132
apps/app_dial.c
|
@ -88,9 +88,12 @@
|
|||
</argument>
|
||||
<xi:include xpointer="xpointer(/docs/info[@name='Dial_Resource'])" />
|
||||
</parameter>
|
||||
<parameter name="timeout" required="false">
|
||||
<parameter name="timeout" required="false" argsep="^">
|
||||
<para>Specifies the number of seconds we attempt to dial the specified devices.</para>
|
||||
<para>If not specified, this defaults to 136 years.</para>
|
||||
<para>If a second argument is specified, this controls the number of seconds we attempt to dial the specified devices
|
||||
without receiving early media or ringing. If neither progress, ringing, nor voice frames have been received when this
|
||||
timeout expires, the call will be treated as a CHANUNAVAIL. This can be used to skip destinations that may not be responsive.</para>
|
||||
</parameter>
|
||||
<parameter name="options" required="false">
|
||||
<optionlist>
|
||||
|
@ -242,6 +245,10 @@
|
|||
<para>Asterisk will ignore any connected line update requests or any redirecting party
|
||||
update requests it may receive on this dial attempt.</para>
|
||||
</option>
|
||||
<option name="j">
|
||||
<para>Use the initial stream topology of the caller for outgoing channels, even if the caller topology has changed.</para>
|
||||
<para>NOTE: For this option to work, it has to be present in all invocations of Dial that the caller channel goes through.</para>
|
||||
</option>
|
||||
<option name="k">
|
||||
<para>Allow the called party to enable parking of the call by sending
|
||||
the DTMF sequence defined for call parking in <filename>features.conf</filename>.</para>
|
||||
|
@ -705,6 +712,7 @@ enum {
|
|||
#define OPT_RING_WITH_EARLY_MEDIA (1LLU << 43)
|
||||
#define OPT_HANGUPCAUSE (1LLU << 44)
|
||||
#define OPT_HEARPULSING (1LLU << 45)
|
||||
#define OPT_TOPOLOGY_PRESERVE (1LLU << 46)
|
||||
|
||||
enum {
|
||||
OPT_ARG_ANNOUNCE = 0,
|
||||
|
@ -749,6 +757,7 @@ AST_APP_OPTIONS(dial_exec_options, BEGIN_OPTIONS
|
|||
AST_APP_OPTION('H', OPT_CALLER_HANGUP),
|
||||
AST_APP_OPTION('i', OPT_IGNORE_FORWARDING),
|
||||
AST_APP_OPTION('I', OPT_IGNORE_CONNECTEDLINE),
|
||||
AST_APP_OPTION('j', OPT_TOPOLOGY_PRESERVE),
|
||||
AST_APP_OPTION('k', OPT_CALLEE_PARK),
|
||||
AST_APP_OPTION('K', OPT_CALLER_PARK),
|
||||
AST_APP_OPTION_ARG('L', OPT_DURATION_LIMIT, OPT_ARG_DURATION_LIMIT),
|
||||
|
@ -808,6 +817,16 @@ struct chanlist {
|
|||
|
||||
AST_LIST_HEAD_NOLOCK(dial_head, chanlist);
|
||||
|
||||
static void topology_ds_destroy(void *data) {
|
||||
struct ast_stream_topology *top = data;
|
||||
ast_stream_topology_free(top);
|
||||
}
|
||||
|
||||
static const struct ast_datastore_info topology_ds_info = {
|
||||
.type = "app_dial_topology_preserve",
|
||||
.destroy = topology_ds_destroy,
|
||||
};
|
||||
|
||||
static int detect_disconnect(struct ast_channel *chan, char code, struct ast_str **featurecode);
|
||||
|
||||
static void chanlist_free(struct chanlist *outgoing)
|
||||
|
@ -1181,7 +1200,7 @@ static void set_duration_var(struct ast_channel *chan, const char *var_base, int
|
|||
}
|
||||
|
||||
static struct ast_channel *wait_for_answer(struct ast_channel *in,
|
||||
struct dial_head *out_chans, int *to, struct ast_flags64 *peerflags,
|
||||
struct dial_head *out_chans, int *to_answer, int *to_progress, struct ast_flags64 *peerflags,
|
||||
char *opt_args[],
|
||||
struct privacy_args *pa,
|
||||
const struct cause_args *num_in, int *result, char *dtmf_progress,
|
||||
|
@ -1194,7 +1213,9 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
|
|||
{
|
||||
struct cause_args num = *num_in;
|
||||
int prestart = num.busy + num.congestion + num.nochan;
|
||||
int orig = *to;
|
||||
int orig_answer_to = *to_answer;
|
||||
int progress_to_dup = *to_progress;
|
||||
int orig_progress_to = *to_progress;
|
||||
struct ast_channel *peer = NULL;
|
||||
struct chanlist *outgoing = AST_LIST_FIRST(out_chans);
|
||||
/* single is set if only one destination is enabled */
|
||||
|
@ -1222,7 +1243,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
|
|||
* there is no point in continuing. The bridge
|
||||
* will just fail if it gets that far.
|
||||
*/
|
||||
*to = -1;
|
||||
*to_answer = -1;
|
||||
strcpy(pa->status, "CONGESTION");
|
||||
ast_channel_publish_dial(in, outgoing->chan, NULL, pa->status);
|
||||
SCOPE_EXIT_RTN_VALUE(NULL, "%s: can't be made compat with %s\n",
|
||||
|
@ -1238,7 +1259,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
|
|||
|
||||
is_cc_recall = ast_cc_is_recall(in, &cc_recall_core_id, NULL);
|
||||
|
||||
while ((*to = ast_remaining_ms(start, orig)) && !peer) {
|
||||
while ((*to_answer = ast_remaining_ms(start, orig_answer_to)) && (*to_progress = ast_remaining_ms(start, progress_to_dup)) && !peer) {
|
||||
struct chanlist *o;
|
||||
int pos = 0; /* how many channels do we handle */
|
||||
int numlines = prestart;
|
||||
|
@ -1264,14 +1285,15 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
|
|||
} else {
|
||||
ast_verb(3, "No one is available to answer at this time (%d:%d/%d/%d)\n", numlines, num.busy, num.congestion, num.nochan);
|
||||
}
|
||||
*to = 0;
|
||||
*to_answer = 0;
|
||||
if (is_cc_recall) {
|
||||
ast_cc_failed(cc_recall_core_id, "Everyone is busy/congested for the recall. How sad");
|
||||
}
|
||||
SCOPE_EXIT_RTN_VALUE(NULL, "%s: No outgoing channels available\n", ast_channel_name(in));
|
||||
}
|
||||
winner = ast_waitfor_n(watchers, pos, to);
|
||||
winner = ast_waitfor_n(watchers, pos, to_answer);
|
||||
AST_LIST_TRAVERSE(out_chans, o, node) {
|
||||
int res = 0;
|
||||
struct ast_frame *f;
|
||||
struct ast_channel *c = o->chan;
|
||||
|
||||
|
@ -1346,7 +1368,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
|
|||
ast_channel_unlock(in);
|
||||
}
|
||||
|
||||
do_forward(o, &num, peerflags, single, caller_entertained, &orig,
|
||||
do_forward(o, &num, peerflags, single, caller_entertained, &orig_answer_to,
|
||||
forced_clid, stored_clid);
|
||||
|
||||
if (o->chan) {
|
||||
|
@ -1483,6 +1505,8 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
|
|||
* fine for ringing frames to get sent through.
|
||||
*/
|
||||
++num_ringing;
|
||||
*to_progress = -1;
|
||||
progress_to_dup = -1;
|
||||
if (ignore_cc || cc_frame_received || num_ringing == numlines) {
|
||||
ast_verb(3, "%s is ringing\n", ast_channel_name(c));
|
||||
/* Setup early media if appropriate */
|
||||
|
@ -1526,6 +1550,8 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
|
|||
ast_indicate(in, AST_CONTROL_PROGRESS);
|
||||
}
|
||||
}
|
||||
*to_progress = -1;
|
||||
progress_to_dup = -1;
|
||||
if (!sent_progress) {
|
||||
struct timeval now, then;
|
||||
int64_t diff;
|
||||
|
@ -1548,7 +1574,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
|
|||
"Sending MF '%s' to %s as result of "
|
||||
"receiving a PROGRESS message.\n",
|
||||
mf_progress, hearpulsing ? "parties" : "called party");
|
||||
ast_mf_stream(c, (hearpulsing ? NULL : in),
|
||||
res |= ast_mf_stream(c, (hearpulsing ? NULL : in),
|
||||
(hearpulsing ? in : NULL), mf_progress, 50, 55, 120, 65, 0);
|
||||
}
|
||||
if (!ast_strlen_zero(sf_progress)) {
|
||||
|
@ -1556,7 +1582,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
|
|||
"Sending SF '%s' to %s as result of "
|
||||
"receiving a PROGRESS message.\n",
|
||||
sf_progress, (hearpulsing ? "parties" : "called party"));
|
||||
ast_sf_stream(c, (hearpulsing ? NULL : in),
|
||||
res |= ast_sf_stream(c, (hearpulsing ? NULL : in),
|
||||
(hearpulsing ? in : NULL), sf_progress, 0, 0);
|
||||
}
|
||||
if (!ast_strlen_zero(dtmf_progress)) {
|
||||
|
@ -1564,7 +1590,11 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
|
|||
"Sending DTMF '%s' to the called party as result of "
|
||||
"receiving a PROGRESS message.\n",
|
||||
dtmf_progress);
|
||||
ast_dtmf_stream(c, in, dtmf_progress, 250, 0);
|
||||
res |= ast_dtmf_stream(c, in, dtmf_progress, 250, 0);
|
||||
}
|
||||
if (res) {
|
||||
ast_log(LOG_WARNING, "Called channel %s hung up post-progress before all digits could be sent\n", ast_channel_name(c));
|
||||
goto wait_over;
|
||||
}
|
||||
}
|
||||
ast_channel_publish_dial(in, c, NULL, "PROGRESS");
|
||||
|
@ -1578,7 +1608,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
|
|||
"Sending MF '%s' to %s as result of "
|
||||
"receiving a WINK message.\n",
|
||||
mf_wink, (hearpulsing ? "parties" : "called party"));
|
||||
ast_mf_stream(c, (hearpulsing ? NULL : in),
|
||||
res |= ast_mf_stream(c, (hearpulsing ? NULL : in),
|
||||
(hearpulsing ? in : NULL), mf_wink, 50, 55, 120, 65, 0);
|
||||
}
|
||||
if (!ast_strlen_zero(sf_wink)) {
|
||||
|
@ -1586,9 +1616,13 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
|
|||
"Sending SF '%s' to %s as result of "
|
||||
"receiving a WINK message.\n",
|
||||
sf_wink, (hearpulsing ? "parties" : "called party"));
|
||||
ast_sf_stream(c, (hearpulsing ? NULL : in),
|
||||
res |= ast_sf_stream(c, (hearpulsing ? NULL : in),
|
||||
(hearpulsing ? in : NULL), sf_wink, 0, 0);
|
||||
}
|
||||
if (res) {
|
||||
ast_log(LOG_WARNING, "Called channel %s hung up post-wink before all digits could be sent\n", ast_channel_name(c));
|
||||
goto wait_over;
|
||||
}
|
||||
}
|
||||
ast_indicate(in, AST_CONTROL_WINK);
|
||||
break;
|
||||
|
@ -1706,6 +1740,8 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
|
|||
if (caller_entertained) {
|
||||
break;
|
||||
}
|
||||
*to_progress = -1;
|
||||
progress_to_dup = -1;
|
||||
/* Fall through */
|
||||
case AST_FRAME_TEXT:
|
||||
if (single && ast_write(in, f)) {
|
||||
|
@ -1734,7 +1770,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
|
|||
#endif
|
||||
if (!f || ((f->frametype == AST_FRAME_CONTROL) && (f->subclass.integer == AST_CONTROL_HANGUP))) {
|
||||
/* Got hung up */
|
||||
*to = -1;
|
||||
*to_answer = -1;
|
||||
strcpy(pa->status, "CANCEL");
|
||||
pa->canceled = 1;
|
||||
publish_dial_end_event(in, out_chans, NULL, pa->status);
|
||||
|
@ -1758,7 +1794,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
|
|||
context = pbx_builtin_getvar_helper(in, "EXITCONTEXT");
|
||||
if (onedigit_goto(in, context, (char) f->subclass.integer, 1)) {
|
||||
ast_verb(3, "User hit %c to disconnect call.\n", f->subclass.integer);
|
||||
*to = 0;
|
||||
*to_answer = 0;
|
||||
*result = f->subclass.integer;
|
||||
strcpy(pa->status, "CANCEL");
|
||||
pa->canceled = 1;
|
||||
|
@ -1777,7 +1813,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
|
|||
if (ast_test_flag64(peerflags, OPT_CALLER_HANGUP) &&
|
||||
detect_disconnect(in, f->subclass.integer, &featurecode)) {
|
||||
ast_verb(3, "User requested call disconnect.\n");
|
||||
*to = 0;
|
||||
*to_answer = 0;
|
||||
strcpy(pa->status, "CANCEL");
|
||||
pa->canceled = 1;
|
||||
publish_dial_end_event(in, out_chans, NULL, pa->status);
|
||||
|
@ -1886,9 +1922,15 @@ skip_frame:;
|
|||
}
|
||||
}
|
||||
|
||||
if (!*to || ast_check_hangup(in)) {
|
||||
ast_verb(3, "Nobody picked up in %d ms\n", orig);
|
||||
wait_over:
|
||||
if (!*to_answer || ast_check_hangup(in)) {
|
||||
ast_verb(3, "Nobody picked up in %d ms\n", orig_answer_to);
|
||||
publish_dial_end_event(in, out_chans, NULL, "NOANSWER");
|
||||
} else if (!*to_progress) {
|
||||
ast_verb(3, "No early media received in %d ms\n", orig_progress_to);
|
||||
publish_dial_end_event(in, out_chans, NULL, "CHANUNAVAIL");
|
||||
strcpy(pa->status, "CHANUNAVAIL");
|
||||
*to_answer = 0; /* Reset to prevent hangup */
|
||||
}
|
||||
|
||||
if (is_cc_recall) {
|
||||
|
@ -2260,7 +2302,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
|
|||
struct chanlist *outgoing;
|
||||
struct chanlist *tmp;
|
||||
struct ast_channel *peer = NULL;
|
||||
int to; /* timeout */
|
||||
int to_answer, to_progress; /* timeouts */
|
||||
struct cause_args num = { chan, 0, 0, 0 };
|
||||
int cause, hanguptreecause = -1;
|
||||
|
||||
|
@ -2316,6 +2358,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
|
|||
*/
|
||||
struct ast_party_caller caller;
|
||||
int max_forwards;
|
||||
struct ast_datastore *topology_ds = NULL;
|
||||
SCOPE_ENTER(1, "%s: Data: %s\n", ast_channel_name(chan), data);
|
||||
|
||||
/* Reset all DIAL variables back to blank, to prevent confusion (in case we don't reset all of them). */
|
||||
|
@ -2617,7 +2660,21 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
|
|||
*/
|
||||
ast_party_connected_line_copy(&tmp->connected, ast_channel_connected(chan));
|
||||
|
||||
topology = ast_stream_topology_clone(ast_channel_get_stream_topology(chan));
|
||||
if (ast_test_flag64(&opts, OPT_TOPOLOGY_PRESERVE)) {
|
||||
topology_ds = ast_channel_datastore_find(chan, &topology_ds_info, NULL);
|
||||
|
||||
if (!topology_ds && (topology_ds = ast_datastore_alloc(&topology_ds_info, NULL))) {
|
||||
topology_ds->data = ast_stream_topology_clone(ast_channel_get_stream_topology(chan));
|
||||
ast_channel_datastore_add(chan, topology_ds);
|
||||
}
|
||||
}
|
||||
|
||||
if (topology_ds) {
|
||||
ao2_ref(topology_ds->data, +1);
|
||||
topology = topology_ds->data;
|
||||
} else {
|
||||
topology = ast_stream_topology_clone(ast_channel_get_stream_topology(chan));
|
||||
}
|
||||
|
||||
ast_channel_unlock(chan);
|
||||
|
||||
|
@ -2856,14 +2913,31 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
|
|||
AST_LIST_TRAVERSE_SAFE_END;
|
||||
|
||||
if (ast_strlen_zero(args.timeout)) {
|
||||
to = -1;
|
||||
to_answer = -1;
|
||||
to_progress = -1;
|
||||
} else {
|
||||
to = atoi(args.timeout);
|
||||
if (to > 0)
|
||||
to *= 1000;
|
||||
else {
|
||||
ast_log(LOG_WARNING, "Invalid timeout specified: '%s'. Setting timeout to infinite\n", args.timeout);
|
||||
to = -1;
|
||||
char *anstimeout = strsep(&args.timeout, "^");
|
||||
if (!ast_strlen_zero(anstimeout)) {
|
||||
to_answer = atoi(anstimeout);
|
||||
if (to_answer > 0) {
|
||||
to_answer *= 1000;
|
||||
} else {
|
||||
ast_log(LOG_WARNING, "Invalid answer timeout specified: '%s'. Setting timeout to infinite\n", args.timeout);
|
||||
to_answer = -1;
|
||||
}
|
||||
} else {
|
||||
to_answer = -1;
|
||||
}
|
||||
if (!ast_strlen_zero(args.timeout)) {
|
||||
to_progress = atoi(args.timeout);
|
||||
if (to_progress > 0) {
|
||||
to_progress *= 1000;
|
||||
} else {
|
||||
ast_log(LOG_WARNING, "Invalid progress timeout specified: '%s'. Setting timeout to infinite\n", args.timeout);
|
||||
to_progress = -1;
|
||||
}
|
||||
} else {
|
||||
to_progress = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2903,7 +2977,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
|
|||
}
|
||||
}
|
||||
|
||||
peer = wait_for_answer(chan, &out_chans, &to, peerflags, opt_args, &pa, &num, &result,
|
||||
peer = wait_for_answer(chan, &out_chans, &to_answer, &to_progress, peerflags, opt_args, &pa, &num, &result,
|
||||
dtmf_progress, mf_progress, mf_wink, sf_progress, sf_wink,
|
||||
(ast_test_flag64(&opts, OPT_HEARPULSING) ? 1 : 0),
|
||||
ignore_cc, &forced_clid, &stored_clid, &config);
|
||||
|
@ -2911,7 +2985,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
|
|||
if (!peer) {
|
||||
if (result) {
|
||||
res = result;
|
||||
} else if (to) { /* Musta gotten hung up */
|
||||
} else if (to_answer) { /* Musta gotten hung up */
|
||||
res = -1;
|
||||
} else { /* Nobody answered, next please? */
|
||||
res = 0;
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "asterisk/say.h"
|
||||
#include "asterisk/app.h"
|
||||
#include "asterisk/utils.h"
|
||||
#include "asterisk/adsi.h"
|
||||
|
||||
/*** DOCUMENTATION
|
||||
<application name="Directory" language="en_US">
|
||||
|
@ -111,12 +112,17 @@
|
|||
<para>Skip calling the extension, instead set it in the <variable>DIRECTORY_EXTEN</variable>
|
||||
channel variable.</para>
|
||||
</option>
|
||||
<option name="d">
|
||||
<para>Enable ADSI support for screen phone searching and retrieval
|
||||
of directory results.</para>
|
||||
<para>Additionally, the channel must be ADSI-enabled and you must
|
||||
have an ADSI-compatible (Type III) CPE for this to work.</para>
|
||||
</option>
|
||||
</optionlist>
|
||||
<note><para>Only one of the <replaceable>f</replaceable>, <replaceable>l</replaceable>, or <replaceable>b</replaceable>
|
||||
options may be specified. <emphasis>If more than one is specified</emphasis>, then Directory will act as
|
||||
if <replaceable>b</replaceable> was specified. The number
|
||||
of characters for the user to type defaults to <literal>3</literal>.</para></note>
|
||||
|
||||
</parameter>
|
||||
</syntax>
|
||||
<description>
|
||||
|
@ -167,6 +173,7 @@ enum {
|
|||
OPT_ALIAS = (1 << 7),
|
||||
OPT_CONFIG_FILE = (1 << 8),
|
||||
OPT_SKIP = (1 << 9),
|
||||
OPT_ADSI = (1 << 10),
|
||||
};
|
||||
|
||||
enum {
|
||||
|
@ -200,8 +207,72 @@ AST_APP_OPTIONS(directory_app_options, {
|
|||
AST_APP_OPTION('a', OPT_ALIAS),
|
||||
AST_APP_OPTION_ARG('c', OPT_CONFIG_FILE, OPT_ARG_FILENAME),
|
||||
AST_APP_OPTION('s', OPT_SKIP),
|
||||
AST_APP_OPTION('d', OPT_ADSI), /* (Would've used 'a', but that was taken already) */
|
||||
});
|
||||
|
||||
static int adsi_search_input(struct ast_channel *chan)
|
||||
{
|
||||
unsigned char buf[256];
|
||||
int bytes = 0;
|
||||
unsigned char keys[6];
|
||||
|
||||
memset(keys, 0, sizeof(keys));
|
||||
|
||||
bytes += ast_adsi_display(buf + bytes, ADSI_COMM_PAGE, 3, ADSI_JUST_CENT, 0, " ", "");
|
||||
bytes += ast_adsi_display(buf + bytes, ADSI_COMM_PAGE, 4, ADSI_JUST_CENT, 0, " ", "");
|
||||
bytes += ast_adsi_set_line(buf + bytes, ADSI_COMM_PAGE, 1);
|
||||
bytes += ast_adsi_input_format(buf + bytes, 1, ADSI_DIR_FROM_LEFT, 0, "Query: ***", "");
|
||||
bytes += ast_adsi_input_control(buf + bytes, ADSI_COMM_PAGE, 4, 1, 1, ADSI_JUST_LEFT);
|
||||
bytes += ast_adsi_load_soft_key(buf + bytes, ADSI_KEY_APPS + 3, "Search", "Search", "#", 1);
|
||||
bytes += ast_adsi_set_keys(buf + bytes, keys);
|
||||
bytes += ast_adsi_voice_mode(buf + bytes, 0);
|
||||
|
||||
ast_debug(3, "Sending ADSI search input screen on %s\n", ast_channel_name(chan));
|
||||
|
||||
return ast_adsi_transmit_message(chan, buf, bytes, ADSI_MSG_DISPLAY);
|
||||
}
|
||||
|
||||
static int adsi_confirm_match(struct ast_channel *chan, int seq, int total, const char *exten, const char *name, int showexten)
|
||||
{
|
||||
unsigned char buf[4096];
|
||||
int alignments[5] = {ADSI_JUST_CENT, ADSI_JUST_CENT, ADSI_JUST_CENT, ADSI_JUST_CENT};
|
||||
char *lines[5] = {NULL, NULL, NULL, NULL, NULL};
|
||||
int x, bytes = 0;
|
||||
unsigned char keys[8];
|
||||
char matchbuf[32];
|
||||
|
||||
snprintf(matchbuf, sizeof(matchbuf), "%d of %d", seq + 1, total); /* Make it 1-indexed for user consumption */
|
||||
|
||||
lines[0] = " "; /* Leave the first line empty so the following lines stand out more */
|
||||
lines[1] = matchbuf;
|
||||
lines[2] = (char*) name;
|
||||
|
||||
if (showexten) {
|
||||
/* If say extension option is set, show it for ADSI as well */
|
||||
lines[3] = (char*) exten;
|
||||
}
|
||||
|
||||
/* Don't use ast_adsi_print here, this way we can send it all at once instead of in 2 transmissions */
|
||||
for (x = 0; lines[x]; x++) {
|
||||
bytes += ast_adsi_display(buf + bytes, ADSI_INFO_PAGE, x + 1, alignments[x], 0, lines[x], "");
|
||||
}
|
||||
bytes += ast_adsi_set_line(buf + bytes, ADSI_INFO_PAGE, 1);
|
||||
|
||||
keys[3] = ADSI_KEY_APPS + 3;
|
||||
keys[4] = ADSI_KEY_APPS + 4;
|
||||
keys[5] = ADSI_KEY_APPS + 5;
|
||||
/* You might think we only need to set the keys up the first time, but nope, we've got to do it each time. */
|
||||
bytes += ast_adsi_load_soft_key(buf + bytes, ADSI_KEY_APPS + 3, "Dial", "Dial", "1", 0);
|
||||
bytes += ast_adsi_load_soft_key(buf + bytes, ADSI_KEY_APPS + 4, "Next", "Next", "*", 0);
|
||||
bytes += ast_adsi_load_soft_key(buf + bytes, ADSI_KEY_APPS + 5, "Exit", "Exit", "#", 0);
|
||||
bytes += ast_adsi_set_keys(buf + bytes, keys);
|
||||
bytes += ast_adsi_voice_mode(buf + bytes, 0);
|
||||
|
||||
ast_debug(3, "Sending ADSI confirmation menu for %s\n", name);
|
||||
|
||||
return ast_adsi_transmit_message(chan, buf, bytes, ADSI_MSG_DISPLAY);
|
||||
}
|
||||
|
||||
static int compare(const char *text, const char *template)
|
||||
{
|
||||
char digit;
|
||||
|
@ -374,6 +445,10 @@ static int select_item_seq(struct ast_channel *chan, struct directory_item **ite
|
|||
for (ptr = items, i = 0; i < count; i++, ptr++) {
|
||||
item = *ptr;
|
||||
|
||||
if (ast_test_flag(flags, OPT_ADSI) && adsi_confirm_match(chan, i, count, item->exten, item->name, ast_test_flag(flags, OPT_SAYEXTENSION))) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (loop = 3 ; loop > 0; loop--) {
|
||||
if (!res)
|
||||
res = play_mailbox_owner(chan, item->context, item->exten, item->name, flags);
|
||||
|
@ -933,6 +1008,18 @@ static int directory_exec(struct ast_channel *chan, const char *data)
|
|||
}
|
||||
digits[7] = digit + '0';
|
||||
|
||||
if (ast_test_flag(&flags, OPT_ADSI)) {
|
||||
if (!ast_adsi_available(chan)) {
|
||||
ast_log(LOG_WARNING, "ADSI not available on %s\n", ast_channel_name(chan));
|
||||
ast_clear_flag(&flags, OPT_ADSI);
|
||||
} else {
|
||||
res = ast_adsi_load_session(chan, NULL, 0, 1);
|
||||
if (res < 0) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ast_channel_state(chan) != AST_STATE_UP) {
|
||||
if (!ast_test_flag(&flags, OPT_NOANSWER)) {
|
||||
/* Otherwise answer unless we're supposed to read while on-hook */
|
||||
|
@ -940,6 +1027,9 @@ static int directory_exec(struct ast_channel *chan, const char *data)
|
|||
}
|
||||
}
|
||||
for (;;) {
|
||||
if (ast_test_flag(&flags, OPT_ADSI) && adsi_search_input(chan)) {
|
||||
return -1;
|
||||
}
|
||||
if (!ast_strlen_zero(dirintro) && !res) {
|
||||
res = ast_stream_and_wait(chan, dirintro, AST_DIGIT_ANY);
|
||||
} else if (!res) {
|
||||
|
|
|
@ -1068,6 +1068,7 @@ static struct ast_channel *findmeexec(struct fm_args *tpargs, struct ast_channel
|
|||
ast_copy_string(num, nm->number, sizeof(num));
|
||||
for (number = num; number; number = rest) {
|
||||
struct ast_channel *outbound;
|
||||
struct ast_format_cap *caps;
|
||||
|
||||
rest = strchr(number, '&');
|
||||
if (rest) {
|
||||
|
@ -1097,8 +1098,15 @@ static struct ast_channel *findmeexec(struct fm_args *tpargs, struct ast_channel
|
|||
? "/n" : "/m");
|
||||
}
|
||||
|
||||
outbound = ast_request("Local", ast_channel_nativeformats(caller), NULL, caller,
|
||||
tmpuser->dialarg, &dg);
|
||||
/* Capture nativeformats reference in case it gets changed */
|
||||
ast_channel_lock(caller);
|
||||
caps = ao2_bump(ast_channel_nativeformats(caller));
|
||||
ast_channel_unlock(caller);
|
||||
|
||||
outbound = ast_request("Local", caps, NULL, caller, tmpuser->dialarg, &dg);
|
||||
|
||||
ao2_cleanup(caps);
|
||||
|
||||
if (!outbound) {
|
||||
ast_log(LOG_WARNING, "Unable to allocate a channel for Local/%s cause: %s\n",
|
||||
tmpuser->dialarg, ast_cause2str(dg));
|
||||
|
|
|
@ -196,6 +196,7 @@ static int find_matching_endif(struct ast_channel *chan, const char *otherapp)
|
|||
if (!ast_rdlock_context(c)) {
|
||||
if (!strcmp(ast_get_context_name(c), ast_channel_context(chan))) {
|
||||
/* This is the matching context we want */
|
||||
|
||||
int cur_priority = ast_channel_priority(chan) + 1, level = 1;
|
||||
|
||||
for (e = find_matching_priority(c, ast_channel_exten(chan), cur_priority,
|
||||
|
@ -203,6 +204,7 @@ static int find_matching_endif(struct ast_channel *chan, const char *otherapp)
|
|||
e;
|
||||
e = find_matching_priority(c, ast_channel_exten(chan), ++cur_priority,
|
||||
S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) {
|
||||
|
||||
if (!strcasecmp(ast_get_extension_app(e), "IF")) {
|
||||
level++;
|
||||
} else if (!strcasecmp(ast_get_extension_app(e), "ENDIF")) {
|
||||
|
@ -283,7 +285,12 @@ static int if_helper(struct ast_channel *chan, const char *data, int end)
|
|||
pbx_builtin_setvar_helper(chan, my_name, NULL);
|
||||
snprintf(end_varname,sizeof(end_varname),"END_%s",varname);
|
||||
ast_channel_lock(chan);
|
||||
endifpri = find_matching_endif(chan, NULL);
|
||||
/* For EndIf, simply go to the next priority.
|
||||
* We do not add 1 to ast_channel_priority because the dialplan will
|
||||
* auto-increment the priority when we return, so just keep the priority as is.
|
||||
* For ExitIf or false If() condition, we need to find the end of the current
|
||||
* If branch (at same indentation) and branch there. */
|
||||
endifpri = end == 2 ? ast_channel_priority(chan) : find_matching_endif(chan, NULL);
|
||||
if ((goto_str = pbx_builtin_getvar_helper(chan, end_varname))) {
|
||||
ast_parseable_goto(chan, goto_str);
|
||||
pbx_builtin_setvar_helper(chan, end_varname, NULL);
|
||||
|
|
|
@ -48,6 +48,13 @@
|
|||
</synopsis>
|
||||
<syntax>
|
||||
<parameter name="filenames" required="true" argsep="&">
|
||||
<para>Ampersand separated list of filenames. If the filename
|
||||
is a relative filename (it does not begin with a slash), it
|
||||
will be searched for in the Asterisk sounds directory. If the
|
||||
filename is able to be parsed as a URL, Asterisk will
|
||||
download the file and then begin playback on it. To include a
|
||||
literal <literal>&</literal> in the URL you can enclose
|
||||
the URL in single quotes.</para>
|
||||
<argument name="filename" required="true" />
|
||||
<argument name="filename2" multiple="true" />
|
||||
</parameter>
|
||||
|
@ -492,7 +499,7 @@ static int playback_exec(struct ast_channel *chan, const char *data)
|
|||
char *front;
|
||||
|
||||
ast_stopstream(chan);
|
||||
while (!res && (front = strsep(&back, "&"))) {
|
||||
while (!res && (front = ast_strsep(&back, '&', AST_STRSEP_STRIP | AST_STRSEP_TRIM))) {
|
||||
if (option_say)
|
||||
res = say_full(chan, front, "", ast_channel_language(chan), NULL, -1, -1);
|
||||
else if (option_mix){
|
||||
|
|
|
@ -230,11 +230,18 @@
|
|||
<para><replaceable>URL</replaceable> will be sent to the called party if the channel supports it.</para>
|
||||
</parameter>
|
||||
<parameter name="announceoverride" argsep="&">
|
||||
<argument name="filename" required="true">
|
||||
<para>Announcement file(s) to play to agent before bridging call, overriding the announcement(s)
|
||||
configured in <filename>queues.conf</filename>, if any.</para>
|
||||
</argument>
|
||||
<argument name="filename2" multiple="true" />
|
||||
<para>Announcement file(s) to play to agent before bridging
|
||||
call, overriding the announcement(s) configured in
|
||||
<filename>queues.conf</filename>, if any.</para>
|
||||
<para>Ampersand separated list of filenames. If the filename
|
||||
is a relative filename (it does not begin with a slash), it
|
||||
will be searched for in the Asterisk sounds directory. If the
|
||||
filename is able to be parsed as a URL, Asterisk will
|
||||
download the file and then begin playback on it. To include a
|
||||
literal <literal>&</literal> in the URL you can enclose
|
||||
the URL in single quotes.</para>
|
||||
<argument name="announceoverride" required="true" />
|
||||
<argument name="announceoverride2" multiple="true" />
|
||||
</parameter>
|
||||
<parameter name="timeout">
|
||||
<para>Will cause the queue to fail out after a specified number of
|
||||
|
@ -1845,6 +1852,7 @@ struct call_queue {
|
|||
int announcepositionlimit; /*!< How many positions we announce? */
|
||||
int announcefrequency; /*!< How often to announce their position */
|
||||
int minannouncefrequency; /*!< The minimum number of seconds between position announcements (def. 15) */
|
||||
int periodicannouncestartdelay; /*!< How long into the queue should the periodic accouncement start */
|
||||
int periodicannouncefrequency; /*!< How often to play periodic announcement */
|
||||
int numperiodicannounce; /*!< The number of periodic announcements configured */
|
||||
int randomperiodicannounce; /*!< Are periodic announcments randomly chosen */
|
||||
|
@ -2975,6 +2983,7 @@ static void init_queue(struct call_queue *q)
|
|||
q->weight = 0;
|
||||
q->timeoutrestart = 0;
|
||||
q->periodicannouncefrequency = 0;
|
||||
q->periodicannouncestartdelay = -1;
|
||||
q->randomperiodicannounce = 0;
|
||||
q->numperiodicannounce = 0;
|
||||
q->relativeperiodicannounce = 0;
|
||||
|
@ -3431,6 +3440,8 @@ static void queue_set_param(struct call_queue *q, const char *param, const char
|
|||
ast_str_set(&q->sound_periodicannounce[0], 0, "%s", val);
|
||||
q->numperiodicannounce = 1;
|
||||
}
|
||||
} else if (!strcasecmp(param, "periodic-announce-startdelay")) {
|
||||
q->periodicannouncestartdelay = atoi(val);
|
||||
} else if (!strcasecmp(param, "periodic-announce-frequency")) {
|
||||
q->periodicannouncefrequency = atoi(val);
|
||||
} else if (!strcasecmp(param, "relative-periodic-announce")) {
|
||||
|
@ -7191,7 +7202,7 @@ static int try_calling(struct queue_ent *qe, struct ast_flags opts, char **opt_a
|
|||
if (!res2 && announce) {
|
||||
char *front;
|
||||
char *announcefiles = ast_strdupa(announce);
|
||||
while ((front = strsep(&announcefiles, "&"))) {
|
||||
while ((front = ast_strsep(&announcefiles, '&', AST_STRSEP_STRIP | AST_STRSEP_TRIM))) {
|
||||
if (play_file(peer, front) < 0) {
|
||||
ast_log(LOG_ERROR, "play_file failed for '%s' on %s\n", front, ast_channel_name(peer));
|
||||
}
|
||||
|
@ -7794,6 +7805,9 @@ static void set_queue_member_pause(struct call_queue *q, struct member *mem, con
|
|||
if (paused && !ast_strlen_zero(reason)) {
|
||||
ast_copy_string(mem->reason_paused, reason, sizeof(mem->reason_paused));
|
||||
} else {
|
||||
/* We end up filling this in again later (temporarily) but we need it
|
||||
* empty for now so that the intervening code - specifically
|
||||
* dump_queue_members() - has the correct view of things. */
|
||||
mem->reason_paused[0] = '\0';
|
||||
}
|
||||
|
||||
|
@ -7812,10 +7826,22 @@ static void set_queue_member_pause(struct call_queue *q, struct member *mem, con
|
|||
"Queue:%s_avail", q->name);
|
||||
}
|
||||
|
||||
ast_queue_log(q->name, "NONE", mem->membername, (paused ? "PAUSE" : "UNPAUSE"),
|
||||
"%s", S_OR(reason, ""));
|
||||
if (!paused && !ast_strlen_zero(reason)) {
|
||||
/* Because we've been unpaused with a 'reason' we need to ensure that
|
||||
* that reason is emitted when the subsequent PauseQueueMember event
|
||||
* is raised. So temporarily set it on the member and clear it out
|
||||
* again right after. */
|
||||
ast_copy_string(mem->reason_paused, reason, sizeof(mem->reason_paused));
|
||||
}
|
||||
|
||||
ast_queue_log(q->name, "NONE", mem->membername, paused ? "PAUSE" : "UNPAUSE",
|
||||
"%s", mem->reason_paused);
|
||||
|
||||
publish_queue_member_pause(q, mem);
|
||||
|
||||
if (!paused) {
|
||||
mem->reason_paused[0] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
static int set_member_paused(const char *queuename, const char *interface, const char *reason, int paused)
|
||||
|
@ -8652,6 +8678,11 @@ static int queue_exec(struct ast_channel *chan, const char *data)
|
|||
}
|
||||
ast_assert(qe.parent != NULL);
|
||||
|
||||
if (qe.parent->periodicannouncestartdelay >= 0) {
|
||||
qe.last_periodic_announce_time += qe.parent->periodicannouncestartdelay;
|
||||
qe.last_periodic_announce_time -= qe.parent->periodicannouncefrequency;
|
||||
}
|
||||
|
||||
ast_queue_log(args.queuename, ast_channel_uniqueid(chan), "NONE", "ENTERQUEUE", "%s|%s|%d",
|
||||
S_OR(args.url, ""),
|
||||
S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, ""),
|
||||
|
@ -10957,7 +10988,7 @@ static char *handle_queue_add_member(struct ast_cli_entry *e, int cmd, struct as
|
|||
case CLI_INIT:
|
||||
e->command = "queue add member";
|
||||
e->usage =
|
||||
"Usage: queue add member <dial string> to <queue> [[[penalty <penalty>] as <membername>] state_interface <interface>]\n"
|
||||
"Usage: queue add member <dial string> to <queue> [penalty <penalty> [as <membername> [state_interface <interface>]]]\n"
|
||||
" Add a dial string (Such as a channel,e.g. SIP/6001) to a queue with optionally: a penalty, membername and a state_interface\n";
|
||||
return NULL;
|
||||
case CLI_GENERATE:
|
||||
|
|
|
@ -49,9 +49,15 @@
|
|||
name.</para>
|
||||
</parameter>
|
||||
<parameter name="filenames" argsep="&">
|
||||
<argument name="filename" required="true">
|
||||
<para>file(s) to play before reading digits or tone with option i</para>
|
||||
</argument>
|
||||
<para>Ampersand separated list of filenames to play before
|
||||
reading digits or tone with option <literal>i</literal>. If
|
||||
the filename is a relative filename (it does not begin with a
|
||||
slash), it will be searched for in the Asterisk sounds
|
||||
directory. If the filename is able to be parsed as a URL,
|
||||
Asterisk will download the file and then begin playback on
|
||||
it. To include a literal <literal>&</literal> in the URL
|
||||
you can enclose the URL in single quotes.</para>
|
||||
<argument name="filename" required="true" />
|
||||
<argument name="filename2" multiple="true" />
|
||||
</parameter>
|
||||
<parameter name="maxdigits">
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* at the top of the source tree.
|
||||
*
|
||||
* Please follow coding guidelines
|
||||
* https://wiki.asterisk.org/wiki/display/AST/Coding+Guidelines
|
||||
* https://docs.asterisk.org/Development/Policies-and-Procedures/Coding-Guidelines/
|
||||
*/
|
||||
|
||||
/*! \file
|
||||
|
@ -371,7 +371,8 @@ static void play_files_helper(struct ast_channel *chan, const char *prompts)
|
|||
char *prompt, *rest = ast_strdupa(prompts);
|
||||
|
||||
ast_stopstream(chan);
|
||||
while ((prompt = strsep(&rest, "&")) && !ast_stream_and_wait(chan, prompt, "")) {
|
||||
while ((prompt = ast_strsep(&rest, '&', AST_STRSEP_STRIP | AST_STRSEP_TRIM))
|
||||
&& !ast_stream_and_wait(chan, prompt, "")) {
|
||||
ast_stopstream(chan);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,7 +85,17 @@
|
|||
Play a sound file and wait for speech to be recognized.
|
||||
</synopsis>
|
||||
<syntax>
|
||||
<parameter name="sound_file" required="true" />
|
||||
<parameter name="sound_file" required="true" argsep="&">
|
||||
<para>Ampersand separated list of filenames. If the filename
|
||||
is a relative filename (it does not begin with a slash), it
|
||||
will be searched for in the Asterisk sounds directory. If the
|
||||
filename is able to be parsed as a URL, Asterisk will
|
||||
download the file and then begin playback on it. To include a
|
||||
literal <literal>&</literal> in the URL you can enclose
|
||||
the URL in single quotes.</para>
|
||||
<argument name="sound_file" required="true" />
|
||||
<argument name="sound_file2" multiple="true" />
|
||||
</parameter>
|
||||
<parameter name="timeout">
|
||||
<para>Timeout integer in seconds. Note the timeout will only start
|
||||
once the sound file has stopped playing.</para>
|
||||
|
@ -95,6 +105,9 @@
|
|||
<option name="n">
|
||||
<para>Don't answer the channel if it has not already been answered.</para>
|
||||
</option>
|
||||
<option name="p">
|
||||
<para>Return partial results when backend is terminated by timeout.</para>
|
||||
</option>
|
||||
</optionlist>
|
||||
</parameter>
|
||||
</syntax>
|
||||
|
@ -690,10 +703,12 @@ static int speech_streamfile(struct ast_channel *chan, const char *filename, con
|
|||
|
||||
enum {
|
||||
SB_OPT_NOANSWER = (1 << 0),
|
||||
SB_OPT_PARTIALRESULTS = (1 << 1),
|
||||
};
|
||||
|
||||
AST_APP_OPTIONS(speech_background_options, BEGIN_OPTIONS
|
||||
AST_APP_OPTION('n', SB_OPT_NOANSWER),
|
||||
AST_APP_OPTION('p', SB_OPT_PARTIALRESULTS),
|
||||
END_OPTIONS );
|
||||
|
||||
/*! \brief SpeechBackground(Sound File,Timeout) Dialplan Application */
|
||||
|
@ -776,7 +791,10 @@ static int speech_background(struct ast_channel *chan, const char *data)
|
|||
/* Okay it's streaming so go into a loop grabbing frames! */
|
||||
while (done == 0) {
|
||||
/* If the filename is null and stream is not running, start up a new sound file */
|
||||
if (!quieted && (ast_channel_streamid(chan) == -1 && ast_channel_timingfunc(chan) == NULL) && (filename = strsep(&filename_tmp, "&"))) {
|
||||
if (!quieted
|
||||
&& ast_channel_streamid(chan) == -1
|
||||
&& ast_channel_timingfunc(chan) == NULL
|
||||
&& (filename = ast_strsep(&filename_tmp, '&', AST_STRSEP_STRIP | AST_STRSEP_TRIM))) {
|
||||
/* Discard old stream information */
|
||||
ast_stopstream(chan);
|
||||
/* Start new stream */
|
||||
|
@ -920,7 +938,10 @@ static int speech_background(struct ast_channel *chan, const char *data)
|
|||
}
|
||||
}
|
||||
|
||||
if (!ast_strlen_zero(dtmf)) {
|
||||
if (ast_strlen_zero(dtmf) && speech->state == AST_SPEECH_STATE_READY && ast_test_flag(&options, SB_OPT_PARTIALRESULTS)) {
|
||||
/* Copy to speech structure the results, even partial ones, if desired and available */
|
||||
speech->results = ast_speech_results_get(speech);
|
||||
} else if (!ast_strlen_zero(dtmf)) {
|
||||
/* We sort of make a results entry */
|
||||
speech->results = ast_calloc(1, sizeof(*speech->results));
|
||||
if (speech->results != NULL) {
|
||||
|
|
|
@ -375,26 +375,6 @@ static int pop_exec(struct ast_channel *chan, const char *data)
|
|||
return res;
|
||||
}
|
||||
|
||||
static int frames_left(struct ast_channel *chan)
|
||||
{
|
||||
struct ast_datastore *stack_store;
|
||||
struct gosub_stack_list *oldlist;
|
||||
int exists;
|
||||
|
||||
ast_channel_lock(chan);
|
||||
stack_store = ast_channel_datastore_find(chan, &stack_info, NULL);
|
||||
if (!stack_store) {
|
||||
ast_channel_unlock(chan);
|
||||
return -1;
|
||||
}
|
||||
oldlist = stack_store->data;
|
||||
AST_LIST_LOCK(oldlist);
|
||||
exists = oldlist->first ? 1 : 0;
|
||||
AST_LIST_UNLOCK(oldlist);
|
||||
ast_channel_unlock(chan);
|
||||
return exists;
|
||||
}
|
||||
|
||||
static int return_exec(struct ast_channel *chan, const char *data)
|
||||
{
|
||||
struct ast_datastore *stack_store;
|
||||
|
@ -402,7 +382,6 @@ static int return_exec(struct ast_channel *chan, const char *data)
|
|||
struct gosub_stack_list *oldlist;
|
||||
const char *retval = data;
|
||||
int res = 0;
|
||||
int lastframe;
|
||||
|
||||
ast_channel_lock(chan);
|
||||
if (!(stack_store = ast_channel_datastore_find(chan, &stack_info, NULL))) {
|
||||
|
@ -414,7 +393,6 @@ static int return_exec(struct ast_channel *chan, const char *data)
|
|||
oldlist = stack_store->data;
|
||||
AST_LIST_LOCK(oldlist);
|
||||
oldframe = AST_LIST_REMOVE_HEAD(oldlist, entries);
|
||||
lastframe = oldlist->first ? 0 : 1;
|
||||
AST_LIST_UNLOCK(oldlist);
|
||||
|
||||
if (!oldframe) {
|
||||
|
@ -432,19 +410,12 @@ static int return_exec(struct ast_channel *chan, const char *data)
|
|||
* what was there before. Channels that do not have a PBX may
|
||||
* not have the context or exten set.
|
||||
*/
|
||||
if (ast_channel_pbx(chan) || !lastframe) {
|
||||
/* If there's no PBX, the "old location" is simply
|
||||
* the configured context for the device, such as
|
||||
* for pre-dial handlers, and restoring this location
|
||||
* is nonsensical. So if no PBX and there are no further
|
||||
* frames, leave the location as it is. */
|
||||
ast_channel_context_set(chan, oldframe->context);
|
||||
ast_channel_exten_set(chan, oldframe->extension);
|
||||
if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_IN_AUTOLOOP)) {
|
||||
--oldframe->priority;
|
||||
}
|
||||
ast_channel_priority_set(chan, oldframe->priority);
|
||||
ast_channel_context_set(chan, oldframe->context);
|
||||
ast_channel_exten_set(chan, oldframe->extension);
|
||||
if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_IN_AUTOLOOP)) {
|
||||
--oldframe->priority;
|
||||
}
|
||||
ast_channel_priority_set(chan, oldframe->priority);
|
||||
ast_set2_flag(ast_channel_flags(chan), oldframe->in_subroutine, AST_FLAG_SUBROUTINE_EXEC);
|
||||
|
||||
gosub_release_frame(chan, oldframe);
|
||||
|
@ -1095,13 +1066,10 @@ static int gosub_run(struct ast_channel *chan, const char *sub_args, int ignore_
|
|||
ast_channel_priority(chan), ast_channel_name(chan));
|
||||
}
|
||||
|
||||
/* Did the routine return?
|
||||
* For things like predial where there's no PBX on the channel yet,
|
||||
* the last return leaves the location alone so we can print it out correctly here.
|
||||
* So to ensure we finished properly, make sure there are no frames left in that case. */
|
||||
if ((!ast_channel_pbx(chan) && !frames_left(chan)) || (ast_channel_priority(chan) == saved_priority
|
||||
/* Did the routine return? */
|
||||
if (ast_channel_priority(chan) == saved_priority
|
||||
&& !strcmp(ast_channel_context(chan), saved_context)
|
||||
&& !strcmp(ast_channel_exten(chan), saved_exten))) {
|
||||
&& !strcmp(ast_channel_exten(chan), saved_exten)) {
|
||||
ast_verb(3, "%s Internal %s(%s) complete GOSUB_RETVAL=%s\n",
|
||||
ast_channel_name(chan), app_gosub, sub_args,
|
||||
S_OR(pbx_builtin_getvar_helper(chan, "GOSUB_RETVAL"), ""));
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
*
|
||||
* \par See also
|
||||
* \arg \ref voicemail.conf "Config_voicemail"
|
||||
* \note For information about voicemail IMAP storage, https://wiki.asterisk.org/wiki/display/AST/IMAP+Voicemail+Storage
|
||||
* \note For information about voicemail IMAP storage, https://docs.asterisk.org/Configuration/Applications/Voicemail/IMAP-Voicemail-Storage/
|
||||
* \ingroup applications
|
||||
* \todo This module requires res_adsi to load. This needs to be optional
|
||||
* during compilation.
|
||||
|
@ -546,6 +546,22 @@
|
|||
as the same as the from.</para>
|
||||
</description>
|
||||
</manager>
|
||||
<managerEvent language="en_US" name="VoicemailPasswordChange">
|
||||
<managerEventInstance class="EVENT_FLAG_USER">
|
||||
<synopsis>Raised in response to a mailbox password change.</synopsis>
|
||||
<syntax>
|
||||
<parameter name="Context">
|
||||
<para>Mailbox context.</para>
|
||||
</parameter>
|
||||
<parameter name="Mailbox">
|
||||
<para>Mailbox name.</para>
|
||||
</parameter>
|
||||
<parameter name="NewPassword">
|
||||
<para>New password for mailbox.</para>
|
||||
</parameter>
|
||||
</syntax>
|
||||
</managerEventInstance>
|
||||
</managerEvent>
|
||||
***/
|
||||
|
||||
#ifdef IMAP_STORAGE
|
||||
|
@ -672,6 +688,7 @@ static AST_LIST_HEAD_STATIC(vmstates, vmstate);
|
|||
#define VM_MESSAGEWRAP (1 << 17) /*!< Wrap around from the last message to the first, and vice-versa */
|
||||
#define VM_FWDURGAUTO (1 << 18) /*!< Autoset of Urgent flag on forwarded Urgent messages set globally */
|
||||
#define VM_EMAIL_EXT_RECS (1 << 19) /*!< Send voicemail emails when an external recording is added to a mailbox */
|
||||
#define VM_MARK_URGENT (1 << 20) /*!< After recording, permit the caller to mark the message as urgent */
|
||||
#define ERROR_LOCK_PATH -100
|
||||
#define ERROR_MAX_MSGS -101
|
||||
#define OPERATOR_EXIT 300
|
||||
|
@ -751,6 +768,18 @@ static const char * const mailbox_folders[] = {
|
|||
"Urgent",
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief Reload voicemail.conf
|
||||
* \param reload Whether this is a reload as opposed to module load
|
||||
* \param force Forcefully reload the config, even it has not changed
|
||||
* \retval 0 on success, nonzero on failure
|
||||
*/
|
||||
static int load_config_force(int reload, int force);
|
||||
|
||||
/*! \brief Forcibly reload voicemail.conf, even if it has not changed.
|
||||
* This is necessary after running unit tests. */
|
||||
#define force_reload_config() load_config_force(1, 1)
|
||||
|
||||
static int load_config(int reload);
|
||||
#ifdef TEST_FRAMEWORK
|
||||
static int load_config_from_memory(int reload, struct ast_config *cfg, struct ast_config *ucfg);
|
||||
|
@ -1410,6 +1439,8 @@ static void apply_option(struct ast_vm_user *vmu, const char *var, const char *v
|
|||
ast_set2_flag(vmu, ast_true(value), VM_SVMAIL);
|
||||
} else if (!strcasecmp(var, "review")){
|
||||
ast_set2_flag(vmu, ast_true(value), VM_REVIEW);
|
||||
} else if (!strcasecmp(var, "leaveurgent")){
|
||||
ast_set2_flag(vmu, ast_true(value), VM_MARK_URGENT);
|
||||
} else if (!strcasecmp(var, "tempgreetwarn")){
|
||||
ast_set2_flag(vmu, ast_true(value), VM_TEMPGREETWARN);
|
||||
} else if (!strcasecmp(var, "messagewrap")){
|
||||
|
@ -1849,6 +1880,16 @@ static int reset_user_pw(const char *context, const char *mailbox, const char *n
|
|||
res = 0;
|
||||
}
|
||||
AST_LIST_UNLOCK(&users);
|
||||
if (!res) {
|
||||
struct ast_json *json_object;
|
||||
|
||||
json_object = ast_json_pack("{s: s, s: s, s: s}",
|
||||
"Context", S_OR(context, "default"),
|
||||
"Mailbox", mailbox,
|
||||
"NewPassword", newpass);
|
||||
ast_manager_publish_event("VoicemailPasswordChange", EVENT_FLAG_SYSTEM | EVENT_FLAG_USER, json_object);
|
||||
ast_json_unref(json_object);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -1892,7 +1933,7 @@ static void vm_change_password(struct ast_vm_user *vmu, const char *newpassword)
|
|||
ast_copy_string(vmu->password, newpassword, sizeof(vmu->password));
|
||||
break;
|
||||
} else {
|
||||
ast_verb(4, "Writing voicemail password to file %s failed, falling back to config file\n", secretfn);
|
||||
ast_log(LOG_WARNING, "Writing voicemail password to file %s failed, falling back to config file\n", secretfn);
|
||||
}
|
||||
/* Fall-through */
|
||||
case OPT_PWLOC_VOICEMAILCONF:
|
||||
|
@ -4086,16 +4127,14 @@ bail:
|
|||
|
||||
/*!
|
||||
* \brief Determines the highest message number in use for a given user and mailbox folder.
|
||||
* \param vmu
|
||||
* \param dir the folder the mailbox folder to look for messages. Used to construct the SQL where clause.
|
||||
*
|
||||
* This method is used when mailboxes are stored in an ODBC back end.
|
||||
* Typical use to set the msgnum would be to take the value returned from this method and add one to it.
|
||||
*
|
||||
* \return the value of zero or greater to indicate the last message index in use, -1 to indicate none.
|
||||
|
||||
*/
|
||||
static int last_message_index(struct ast_vm_user *vmu, char *dir)
|
||||
static int last_message_index(char *dir)
|
||||
{
|
||||
int x = -1;
|
||||
int res;
|
||||
|
@ -4380,15 +4419,15 @@ static SQLHSTMT insert_data_cb(struct odbc_obj *obj, void *vdata)
|
|||
SQLBindParameter(stmt, 2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->msgnums), 0, (void *) data->msgnums, 0, NULL);
|
||||
SQLBindParameter(stmt, 3, SQL_PARAM_INPUT, SQL_C_BINARY, SQL_LONGVARBINARY, data->datalen, 0, (void *) data->data, data->datalen, &data->indlen);
|
||||
SQLBindParameter(stmt, 4, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->context), 0, (void *) data->context, 0, NULL);
|
||||
SQLBindParameter(stmt, 6, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->callerid), 0, (void *) data->callerid, 0, NULL);
|
||||
SQLBindParameter(stmt, 7, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->origtime), 0, (void *) data->origtime, 0, NULL);
|
||||
SQLBindParameter(stmt, 8, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->duration), 0, (void *) data->duration, 0, NULL);
|
||||
SQLBindParameter(stmt, 9, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->mailboxuser), 0, (void *) data->mailboxuser, 0, NULL);
|
||||
SQLBindParameter(stmt, 10, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->mailboxcontext), 0, (void *) data->mailboxcontext, 0, NULL);
|
||||
SQLBindParameter(stmt, 11, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->flag), 0, (void *) data->flag, 0, NULL);
|
||||
SQLBindParameter(stmt, 12, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->msg_id), 0, (void *) data->msg_id, 0, NULL);
|
||||
SQLBindParameter(stmt, 5, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->callerid), 0, (void *) data->callerid, 0, NULL);
|
||||
SQLBindParameter(stmt, 6, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->origtime), 0, (void *) data->origtime, 0, NULL);
|
||||
SQLBindParameter(stmt, 7, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->duration), 0, (void *) data->duration, 0, NULL);
|
||||
SQLBindParameter(stmt, 8, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->mailboxuser), 0, (void *) data->mailboxuser, 0, NULL);
|
||||
SQLBindParameter(stmt, 9, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->mailboxcontext), 0, (void *) data->mailboxcontext, 0, NULL);
|
||||
SQLBindParameter(stmt, 10, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->flag), 0, (void *) data->flag, 0, NULL);
|
||||
SQLBindParameter(stmt, 11, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->msg_id), 0, (void *) data->msg_id, 0, NULL);
|
||||
if (!ast_strlen_zero(data->category)) {
|
||||
SQLBindParameter(stmt, 13, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->category), 0, (void *) data->category, 0, NULL);
|
||||
SQLBindParameter(stmt, 12, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->category), 0, (void *) data->category, 0, NULL);
|
||||
}
|
||||
res = ast_odbc_execute_sql(obj, stmt, data->sql);
|
||||
if (!SQL_SUCCEEDED(res)) {
|
||||
|
@ -4658,7 +4697,6 @@ static void rename_file(char *sfn, char *dfn)
|
|||
|
||||
/*!
|
||||
* \brief Determines the highest message number in use for a given user and mailbox folder.
|
||||
* \param vmu
|
||||
* \param dir the folder the mailbox folder to look for messages. Used to construct the SQL where clause.
|
||||
*
|
||||
* This method is used when mailboxes are stored on the filesystem. (not ODBC and not IMAP).
|
||||
|
@ -4667,7 +4705,7 @@ static void rename_file(char *sfn, char *dfn)
|
|||
* \note Should always be called with a lock already set on dir.
|
||||
* \return the value of zero or greaterto indicate the last message index in use, -1 to indicate none.
|
||||
*/
|
||||
static int last_message_index(struct ast_vm_user *vmu, char *dir)
|
||||
static int last_message_index(char *dir)
|
||||
{
|
||||
int x;
|
||||
unsigned char map[MAXMSGLIMIT] = "";
|
||||
|
@ -4694,12 +4732,8 @@ static int last_message_index(struct ast_vm_user *vmu, char *dir)
|
|||
}
|
||||
closedir(msgdir);
|
||||
|
||||
for (x = 0; x < vmu->maxmsg; x++) {
|
||||
if (map[x] == 1) {
|
||||
stopcount--;
|
||||
} else if (map[x] == 0 && !stopcount) {
|
||||
break;
|
||||
}
|
||||
for (x = 0; x < MAXMSGLIMIT && stopcount; x++) {
|
||||
stopcount -= map[x];
|
||||
}
|
||||
|
||||
return x - 1;
|
||||
|
@ -5972,7 +6006,7 @@ static int copy_message(struct ast_channel *chan, struct ast_vm_user *vmu, int i
|
|||
if (vm_lock_path(todir))
|
||||
return ERROR_LOCK_PATH;
|
||||
|
||||
recipmsgnum = last_message_index(recip, todir) + 1;
|
||||
recipmsgnum = last_message_index(todir) + 1;
|
||||
if (recipmsgnum < recip->maxmsg - (imbox ? 0 : inprocess_count(vmu->mailbox, vmu->context, 0))) {
|
||||
make_file(topath, sizeof(topath), todir, recipmsgnum);
|
||||
#ifndef ODBC_STORAGE
|
||||
|
@ -6467,7 +6501,7 @@ static int msg_create_from_file(struct ast_vm_recording_data *recdata)
|
|||
return -1;
|
||||
}
|
||||
|
||||
msgnum = last_message_index(recipient, dir) + 1;
|
||||
msgnum = last_message_index(dir) + 1;
|
||||
#endif
|
||||
|
||||
/* Lock the directory receiving the voicemail since we want it to still exist when we attempt to copy the voicemail.
|
||||
|
@ -7035,7 +7069,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_
|
|||
}
|
||||
} else {
|
||||
#ifndef IMAP_STORAGE
|
||||
msgnum = last_message_index(vmu, dir) + 1;
|
||||
msgnum = last_message_index(dir) + 1;
|
||||
#endif
|
||||
make_file(fn, sizeof(fn), dir, msgnum);
|
||||
|
||||
|
@ -7157,7 +7191,7 @@ static int resequence_mailbox(struct ast_vm_user *vmu, char *dir, int stopcount)
|
|||
return ERROR_LOCK_PATH;
|
||||
}
|
||||
|
||||
for (x = 0, dest = 0; dest != stopcount && x < vmu->maxmsg + 10; x++) {
|
||||
for (x = 0, dest = 0; dest != stopcount && x < MAXMSGLIMIT; x++) {
|
||||
make_file(sfn, sizeof(sfn), dir, x);
|
||||
if (EXISTS(dir, x, sfn, NULL)) {
|
||||
|
||||
|
@ -7246,7 +7280,7 @@ static int save_to_folder(struct ast_vm_user *vmu, struct vm_state *vms, int msg
|
|||
if (vm_lock_path(ddir))
|
||||
return ERROR_LOCK_PATH;
|
||||
|
||||
x = last_message_index(vmu, ddir) + 1;
|
||||
x = last_message_index(ddir) + 1;
|
||||
|
||||
if (box == 10 && x >= vmu->maxdeletedmsg) { /* "Deleted" folder*/
|
||||
x--;
|
||||
|
@ -7422,8 +7456,11 @@ static void adsi_begin(struct ast_channel *chan, int *useadsi)
|
|||
if (!ast_adsi_available(chan))
|
||||
return;
|
||||
x = ast_adsi_load_session(chan, adsifdn, adsiver, 1);
|
||||
if (x < 0)
|
||||
if (x < 0) {
|
||||
*useadsi = 0;
|
||||
ast_channel_adsicpe_set(chan, AST_ADSI_UNAVAILABLE);
|
||||
return;
|
||||
}
|
||||
if (!x) {
|
||||
if (adsi_load_vmail(chan, useadsi)) {
|
||||
ast_log(AST_LOG_WARNING, "Unable to upload voicemail scripts\n");
|
||||
|
@ -9103,8 +9140,8 @@ static int open_mailbox(struct vm_state *vms, struct ast_vm_user *vmu, int box)
|
|||
return ERROR_LOCK_PATH;
|
||||
}
|
||||
|
||||
/* for local storage, checks directory for messages up to maxmsg limit */
|
||||
last_msg = last_message_index(vmu, vms->curdir);
|
||||
/* for local storage, checks directory for messages up to MAXMSGLIMIT */
|
||||
last_msg = last_message_index(vms->curdir);
|
||||
ast_unlock_path(vms->curdir);
|
||||
|
||||
if (last_msg < -1) {
|
||||
|
@ -9140,7 +9177,7 @@ static int close_mailbox(struct vm_state *vms, struct ast_vm_user *vmu)
|
|||
}
|
||||
|
||||
/* update count as message may have arrived while we've got mailbox open */
|
||||
last_msg_idx = last_message_index(vmu, vms->curdir);
|
||||
last_msg_idx = last_message_index(vms->curdir);
|
||||
if (last_msg_idx != vms->lastmsg) {
|
||||
ast_log(AST_LOG_NOTICE, "%d messages received after mailbox opened.\n", last_msg_idx - vms->lastmsg);
|
||||
}
|
||||
|
@ -11550,6 +11587,7 @@ static int show_mailbox_snapshot(struct ast_cli_args *a)
|
|||
const char *context = a->argv[4];
|
||||
struct ast_vm_mailbox_snapshot *mailbox_snapshot;
|
||||
struct ast_vm_msg_snapshot *msg;
|
||||
int i;
|
||||
|
||||
/* Take a snapshot of the mailbox and walk through each folder's contents */
|
||||
mailbox_snapshot = ast_vm_mailbox_snapshot_create(mailbox, context, NULL, 0, AST_VM_SNAPSHOT_SORT_BY_ID, 0);
|
||||
|
@ -11560,7 +11598,7 @@ static int show_mailbox_snapshot(struct ast_cli_args *a)
|
|||
|
||||
ast_cli(a->fd, VM_STRING_HEADER_FORMAT, "Folder", "Caller ID", "Date", "Duration", "Flag", "ID");
|
||||
|
||||
for (int i = 0; i < mailbox_snapshot->folders; i++) {
|
||||
for (i = 0; i < mailbox_snapshot->folders; i++) {
|
||||
AST_LIST_TRAVERSE(&((mailbox_snapshot)->snapshots[i]), msg, msg) {
|
||||
ast_cli(a->fd, VM_STRING_HEADER_FORMAT, msg->folder_name, msg->callerid, msg->origdate, msg->duration,
|
||||
msg->flag, msg->msg_id);
|
||||
|
@ -11777,9 +11815,10 @@ static char *complete_voicemail_move_message(struct ast_cli_args *a, int maxpos)
|
|||
}
|
||||
AST_LIST_UNLOCK(&users);
|
||||
} else if (pos == 4 || pos == 8 || (pos == 6 && maxpos == 6) ) {
|
||||
int i;
|
||||
/* Walk through the standard folders */
|
||||
wordlen = strlen(word);
|
||||
for (int i = 0; i < ARRAY_LEN(mailbox_folders); i++) {
|
||||
for (i = 0; i < ARRAY_LEN(mailbox_folders); i++) {
|
||||
if (folder && !strncasecmp(word, mailbox_folders[i], wordlen) && ++which > state) {
|
||||
return ast_strdup(mailbox_folders[i]);
|
||||
}
|
||||
|
@ -11789,7 +11828,6 @@ static char *complete_voicemail_move_message(struct ast_cli_args *a, int maxpos)
|
|||
/* find messages in the folder */
|
||||
struct ast_vm_mailbox_snapshot *mailbox_snapshot;
|
||||
struct ast_vm_msg_snapshot *msg;
|
||||
int i = 0;
|
||||
mailbox = a->argv[2];
|
||||
context = a->argv[3];
|
||||
folder = a->argv[4];
|
||||
|
@ -11797,6 +11835,7 @@ static char *complete_voicemail_move_message(struct ast_cli_args *a, int maxpos)
|
|||
|
||||
/* Take a snapshot of the mailbox and snag the individual info */
|
||||
if ((mailbox_snapshot = ast_vm_mailbox_snapshot_create(mailbox, context, folder, 0, AST_VM_SNAPSHOT_SORT_BY_ID, 0))) {
|
||||
int i;
|
||||
/* we are only requesting the one folder, but we still need to know it's index */
|
||||
for (i = 0; i < ARRAY_LEN(mailbox_folders); i++) {
|
||||
if (!strcasecmp(mailbox_folders[i], folder)) {
|
||||
|
@ -12897,7 +12936,7 @@ AST_TEST_DEFINE(test_voicemail_vmuser)
|
|||
/* language parameter seems to only be used for display in manager action */
|
||||
static const char options_string[] = "attach=yes|attachfmt=wav49|"
|
||||
"serveremail=someguy@digium.com|fromstring=Voicemail System|tz=central|delete=yes|saycid=yes|"
|
||||
"sendvoicemail=yes|review=yes|tempgreetwarn=yes|messagewrap=yes|operator=yes|"
|
||||
"sendvoicemail=yes|review=yes|tempgreetwarn=yes|messagewrap=yes|operator=yes|leaveurgent=yes|"
|
||||
"envelope=yes|moveheard=yes|sayduration=yes|saydurationm=5|forcename=yes|"
|
||||
"forcegreetings=yes|callback=somecontext|dialout=somecontext2|"
|
||||
"exitcontext=somecontext3|minsecs=10|maxsecs=100|nextaftercmd=yes|"
|
||||
|
@ -12973,6 +13012,10 @@ AST_TEST_DEFINE(test_voicemail_vmuser)
|
|||
ast_test_status_update(test, "Parse failure for review option\n");
|
||||
res = 1;
|
||||
}
|
||||
if (!ast_test_flag(vmu, VM_MARK_URGENT)) {
|
||||
ast_test_status_update(test, "Parse failure for leaveurgent option\n");
|
||||
res = 1;
|
||||
}
|
||||
if (!ast_test_flag(vmu, VM_TEMPGREETWARN)) {
|
||||
ast_test_status_update(test, "Parse failure for tempgreetwarm option\n");
|
||||
res = 1;
|
||||
|
@ -13079,6 +13122,7 @@ AST_TEST_DEFINE(test_voicemail_vmuser)
|
|||
#endif
|
||||
|
||||
free_user(vmu);
|
||||
force_reload_config(); /* Restore original config */
|
||||
return res ? AST_TEST_FAIL : AST_TEST_PASS;
|
||||
}
|
||||
#endif
|
||||
|
@ -13703,6 +13747,7 @@ static int append_vmu_info_astman(
|
|||
"DeleteMessage: %s\r\n"
|
||||
"VolumeGain: %.2f\r\n"
|
||||
"CanReview: %s\r\n"
|
||||
"CanMarkUrgent: %s\r\n"
|
||||
"CallOperator: %s\r\n"
|
||||
"MaxMessageCount: %d\r\n"
|
||||
"MaxMessageLength: %d\r\n"
|
||||
|
@ -13740,6 +13785,7 @@ static int append_vmu_info_astman(
|
|||
ast_test_flag(vmu, VM_DELETE) ? "Yes" : "No",
|
||||
vmu->volgain,
|
||||
ast_test_flag(vmu, VM_REVIEW) ? "Yes" : "No",
|
||||
ast_test_flag(vmu, VM_MARK_URGENT) ? "Yes" : "No",
|
||||
ast_test_flag(vmu, VM_OPERATOR) ? "Yes" : "No",
|
||||
vmu->maxmsg,
|
||||
vmu->maxsecs,
|
||||
|
@ -13773,6 +13819,7 @@ static int append_vmbox_info_astman(
|
|||
struct ast_vm_mailbox_snapshot *mailbox_snapshot;
|
||||
struct ast_vm_msg_snapshot *msg;
|
||||
int nummessages = 0;
|
||||
int i;
|
||||
|
||||
/* Take a snapshot of the mailbox */
|
||||
mailbox_snapshot = ast_vm_mailbox_snapshot_create(vmu->mailbox, vmu->context, NULL, 0, AST_VM_SNAPSHOT_SORT_BY_ID, 0);
|
||||
|
@ -13784,7 +13831,7 @@ static int append_vmbox_info_astman(
|
|||
|
||||
astman_send_listack(s, m, "Voicemail box detail will follow", "start");
|
||||
/* walk through each folder's contents and append info for each message */
|
||||
for (int i = 0; i < mailbox_snapshot->folders; i++) {
|
||||
for (i = 0; i < mailbox_snapshot->folders; i++) {
|
||||
AST_LIST_TRAVERSE(&((mailbox_snapshot)->snapshots[i]), msg, msg) {
|
||||
astman_append(s,
|
||||
"Event: %s\r\n"
|
||||
|
@ -14168,10 +14215,10 @@ static const char *substitute_escapes(const char *value)
|
|||
return ast_str_buffer(str);
|
||||
}
|
||||
|
||||
static int load_config(int reload)
|
||||
static int load_config_force(int reload, int force)
|
||||
{
|
||||
struct ast_config *cfg, *ucfg;
|
||||
struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
|
||||
struct ast_flags config_flags = { reload && !force ? CONFIG_FLAG_FILEUNCHANGED : 0 };
|
||||
int res;
|
||||
|
||||
ast_unload_realtime("voicemail");
|
||||
|
@ -14209,6 +14256,11 @@ static int load_config(int reload)
|
|||
return res;
|
||||
}
|
||||
|
||||
static int load_config(int reload)
|
||||
{
|
||||
return load_config_force(reload, 0);
|
||||
}
|
||||
|
||||
#ifdef TEST_FRAMEWORK
|
||||
static int load_config_from_memory(int reload, struct ast_config *cfg, struct ast_config *ucfg)
|
||||
{
|
||||
|
@ -14703,6 +14755,14 @@ static int actual_load_config(int reload, struct ast_config *cfg, struct ast_con
|
|||
}
|
||||
ast_set2_flag((&globalflags), ast_true(val), VM_REVIEW);
|
||||
|
||||
if (!(val = ast_variable_retrieve(cfg, "general", "leaveurgent"))){
|
||||
val = "yes";
|
||||
} else if (ast_false(val)) {
|
||||
ast_debug(1, "VM leave urgent messages disabled globally\n");
|
||||
val = "no";
|
||||
}
|
||||
ast_set2_flag((&globalflags), ast_true(val), VM_MARK_URGENT);
|
||||
|
||||
/* Temporary greeting reminder */
|
||||
if (!(val = ast_variable_retrieve(cfg, "general", "tempgreetwarn"))) {
|
||||
ast_debug(1, "VM Temporary Greeting Reminder Option disabled globally\n");
|
||||
|
@ -15375,6 +15435,7 @@ AST_TEST_DEFINE(test_voicemail_msgcount)
|
|||
}
|
||||
|
||||
free_user(vmu);
|
||||
force_reload_config(); /* Restore original config */
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -15485,6 +15546,7 @@ AST_TEST_DEFINE(test_voicemail_notify_endl)
|
|||
}
|
||||
fclose(file);
|
||||
free_user(vmu);
|
||||
force_reload_config(); /* Restore original config */
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -15557,8 +15619,8 @@ AST_TEST_DEFINE(test_voicemail_load_config)
|
|||
|
||||
#undef CHECK
|
||||
|
||||
/* restore config */
|
||||
load_config(1); /* this might say "Failed to load configuration file." */
|
||||
/* Forcibly restore the original config, to reinitialize after test */
|
||||
force_reload_config(); /* this might say "Failed to load configuration file." */
|
||||
|
||||
cleanup:
|
||||
unlink(config_filename);
|
||||
|
@ -15624,6 +15686,11 @@ AST_TEST_DEFINE(test_voicemail_vm_info)
|
|||
populate_defaults(vmu);
|
||||
|
||||
vmu->email = ast_strdup("vm-info-test@example.net");
|
||||
if (!vmu->email) {
|
||||
ast_test_status_update(test, "Cannot create vmu email\n");
|
||||
chan = ast_channel_unref(chan);
|
||||
return AST_TEST_FAIL;
|
||||
}
|
||||
ast_copy_string(vmu->fullname, "Test Framework Mailbox", sizeof(vmu->fullname));
|
||||
ast_copy_string(vmu->pager, "vm-info-pager-test@example.net", sizeof(vmu->pager));
|
||||
ast_copy_string(vmu->language, "en", sizeof(vmu->language));
|
||||
|
@ -16270,7 +16337,7 @@ static int play_record_review(struct ast_channel *chan, char *playfile, char *re
|
|||
}
|
||||
break;
|
||||
case '4':
|
||||
if (outsidecaller) { /* only mark vm messages */
|
||||
if (outsidecaller && ast_test_flag(vmu, VM_MARK_URGENT)) { /* only mark vm messages */
|
||||
/* Mark Urgent */
|
||||
if ((flag && ast_strlen_zero(flag)) || (!ast_strlen_zero(flag) && strcmp(flag, "Urgent"))) {
|
||||
ast_verb(3, "marking message as Urgent\n");
|
||||
|
@ -16347,7 +16414,7 @@ static int play_record_review(struct ast_channel *chan, char *playfile, char *re
|
|||
return cmd;
|
||||
if (msg_exists) {
|
||||
cmd = ast_play_and_wait(chan, "vm-review");
|
||||
if (!cmd && outsidecaller) {
|
||||
if (!cmd && outsidecaller && ast_test_flag(vmu, VM_MARK_URGENT)) {
|
||||
if ((flag && ast_strlen_zero(flag)) || (!ast_strlen_zero(flag) && strcmp(flag, "Urgent"))) {
|
||||
cmd = ast_play_and_wait(chan, "vm-review-urgent");
|
||||
} else if (flag) {
|
||||
|
|
|
@ -2220,6 +2220,30 @@ static int user_template_handler(const struct aco_option *opt, struct ast_variab
|
|||
return conf_find_user_profile(NULL, var->value, u_profile) ? 0 : -1;
|
||||
}
|
||||
|
||||
static int sample_rate_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
|
||||
{
|
||||
struct bridge_profile *b_profile = obj;
|
||||
unsigned int *slot;
|
||||
|
||||
if (!strcasecmp(var->name, "internal_sample_rate")) {
|
||||
slot = &b_profile->internal_sample_rate;
|
||||
if (!strcasecmp(var->value, "auto")) {
|
||||
*slot = 0;
|
||||
return 0;
|
||||
}
|
||||
} else if (!strcasecmp(var->name, "maximum_sample_rate")) {
|
||||
slot = &b_profile->maximum_sample_rate;
|
||||
if (!strcasecmp(var->value, "none")) {
|
||||
*slot = 0;
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ast_parse_arg(var->value, PARSE_UINT32 | PARSE_IN_RANGE, slot, 8000, 192000);
|
||||
}
|
||||
|
||||
static int bridge_template_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
|
||||
{
|
||||
struct bridge_profile *b_profile = obj;
|
||||
|
@ -2437,10 +2461,9 @@ int conf_load_config(void)
|
|||
/* Bridge options */
|
||||
aco_option_register(&cfg_info, "type", ACO_EXACT, bridge_types, NULL, OPT_NOOP_T, 0, 0);
|
||||
aco_option_register(&cfg_info, "jitterbuffer", ACO_EXACT, bridge_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct bridge_profile, flags), USER_OPT_JITTERBUFFER);
|
||||
/* "auto" will fail to parse as a uint, but we use PARSE_DEFAULT to set the value to 0 in that case, which is the value that auto resolves to */
|
||||
aco_option_register(&cfg_info, "internal_sample_rate", ACO_EXACT, bridge_types, "0", OPT_UINT_T, PARSE_DEFAULT, FLDSET(struct bridge_profile, internal_sample_rate), 0);
|
||||
aco_option_register_custom(&cfg_info, "internal_sample_rate", ACO_EXACT, bridge_types, "auto", sample_rate_handler, 0);
|
||||
aco_option_register(&cfg_info, "binaural_active", ACO_EXACT, bridge_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct bridge_profile, flags), BRIDGE_OPT_BINAURAL_ACTIVE);
|
||||
aco_option_register(&cfg_info, "maximum_sample_rate", ACO_EXACT, bridge_types, "0", OPT_UINT_T, PARSE_DEFAULT, FLDSET(struct bridge_profile, maximum_sample_rate), 0);
|
||||
aco_option_register_custom(&cfg_info, "maximum_sample_rate", ACO_EXACT, bridge_types, "none", sample_rate_handler, 0);
|
||||
aco_option_register_custom(&cfg_info, "mixing_interval", ACO_EXACT, bridge_types, "20", mix_interval_handler, 0);
|
||||
aco_option_register(&cfg_info, "record_conference", ACO_EXACT, bridge_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct bridge_profile, flags), BRIDGE_OPT_RECORD_CONFERENCE);
|
||||
aco_option_register_custom(&cfg_info, "video_mode", ACO_EXACT, bridge_types, NULL, video_mode_handler, 0);
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
*
|
||||
* \author\verbatim Terry Wilson <twilson@digium.com> \endverbatim
|
||||
*
|
||||
* See https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes for
|
||||
* See https://docs.asterisk.org/Development/Reference-Information/Other-Reference-Information/Confbridge-state-changes/ for
|
||||
* a more complete description of how conference states work.
|
||||
*/
|
||||
|
||||
|
|
|
@ -9,9 +9,9 @@ check_for_app() {
|
|||
fi
|
||||
}
|
||||
|
||||
# OpenBSD: pkg_add autoconf%2.63 automake%1.9 metaauto
|
||||
test -n "$AUTOCONF_VERSION" || export AUTOCONF_VERSION=2.63
|
||||
test -n "$AUTOMAKE_VERSION" || export AUTOMAKE_VERSION=1.9
|
||||
# OpenBSD: pkg_add autoconf%2.69 automake%1.16 metaauto
|
||||
test -n "$AUTOCONF_VERSION" || export AUTOCONF_VERSION=2.69
|
||||
test -n "$AUTOMAKE_VERSION" || export AUTOMAKE_VERSION=1.16
|
||||
|
||||
check_for_app autoconf
|
||||
check_for_app autoheader
|
||||
|
|
|
@ -181,7 +181,14 @@ static int simple_bridge_join(struct ast_bridge *bridge, struct ast_bridge_chann
|
|||
return 0;
|
||||
}
|
||||
|
||||
ast_channel_request_stream_topology_change(c1, new_top, &simple_bridge);
|
||||
if (!ast_stream_topology_equal(new_top, existing_top)) {
|
||||
ast_channel_request_stream_topology_change(c1, new_top, &simple_bridge);
|
||||
} else {
|
||||
ast_debug(3, "%s: Topologies already match. Current: %s Requested: %s\n",
|
||||
ast_channel_name(c1),
|
||||
ast_str_tmp(256, ast_stream_topology_to_str(existing_top, &STR_TMP)),
|
||||
ast_str_tmp(256, ast_stream_topology_to_str(new_top, &STR_TMP)));
|
||||
}
|
||||
ast_stream_topology_free(new_top);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
<support_level>extended</support_level>
|
||||
</member>
|
||||
<member name="DETECT_DEADLOCKS" displayname="Detect Deadlocks">
|
||||
<depend>DEBUG_THREADS</depend>
|
||||
<support_level>extended</support_level>
|
||||
</member>
|
||||
<member name="DUMP_SCHEDULER" displayname="Dump Scheduler Contents for Debugging">
|
||||
|
|
|
@ -128,4 +128,8 @@
|
|||
<defaultenabled>yes</defaultenabled>
|
||||
<depend>native_arch</depend>
|
||||
</member>
|
||||
<member name="ADD_CFLAGS_TO_BUILDOPTS_H" displayname="Add ALL of the flags on this page to buildopts.h. Useful for IDEs but may cause slightly longer compile times after flags are changed.">
|
||||
<support_level>core</support_level>
|
||||
<defaultenabled>no</defaultenabled>
|
||||
</member>
|
||||
</category>
|
||||
|
|
|
@ -58,7 +58,7 @@ if [[ -z ${cache_dir} ]] ; then
|
|||
fi
|
||||
|
||||
version=$(${ASTTOPDIR}/build_tools/make_version ${ASTTOPDIR})
|
||||
if [[ ! ${version} =~ ^(GIT-)?(certified/)?([^.-]+)[.-].* ]] ; then
|
||||
if [[ ! ${version} =~ ^(GIT-)?(certified[/-])?([^.-]+)[.-].* ]] ; then
|
||||
echo "${module_name}: Couldn't parse version ${version}"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -172,7 +172,7 @@ if [[ -f ${DESTDIR}${ASTMODDIR}/${module_name}.manifest.xml ]] ; then
|
|||
|
||||
cs=$(${MD5} ${f} | cut -b1-32)
|
||||
if [[ "${cs}" != "${sum}" ]] ; then
|
||||
echo Checksum mismatch: ${f}
|
||||
echo "Checksum mismatch: ${f}"
|
||||
need_install=1
|
||||
break
|
||||
fi
|
||||
|
@ -194,8 +194,8 @@ else
|
|||
fi
|
||||
|
||||
need_download=1
|
||||
if [[ -f ${cache_dir}/${full_name}.manifest.xml ]] ; then
|
||||
cpv=$(${XMLSTARLET} sel -t -v "/package/@version" ${cache_dir}/${full_name}.manifest.xml)
|
||||
if [[ -f ${cache_dir}/${full_name}-${major_version}.manifest.xml ]] ; then
|
||||
cpv=$(${XMLSTARLET} sel -t -v "/package/@version" ${cache_dir}/${full_name}-${major_version}.manifest.xml)
|
||||
cpvi=$(version_convert ${cpv})
|
||||
echo "${full_name}: Cached package version ${cpv} (${cpvi})"
|
||||
if [[ ${cpvi} == ${rpvi} && ( -f ${cache_dir}/${tarball} ) ]] ; then
|
||||
|
@ -210,7 +210,7 @@ if [[ ${need_download} = 1 ]] ; then
|
|||
echo "${full_name}: Unable to fetch ${remote_url}/${tarball}"
|
||||
exit 1
|
||||
}
|
||||
cp ${tmpdir}/${variant_manifest} ${cache_dir}/${full_name}.manifest.xml
|
||||
cp ${tmpdir}/${variant_manifest} ${cache_dir}/${full_name}-${major_version}.manifest.xml
|
||||
fi
|
||||
|
||||
tar -xzf ${cache_dir}/${tarball} -C ${cache_dir}
|
||||
|
|
|
@ -18,42 +18,79 @@ then
|
|||
# gets added to BUILDOPTS.
|
||||
fi
|
||||
|
||||
TMP=`${GREP} -e "^MENUSELECT_CFLAGS" menuselect.makeopts | sed 's/MENUSELECT_CFLAGS\=//g' | sed 's/-D//g'`
|
||||
for x in ${TMP}; do
|
||||
if test "${x}" = "AO2_DEBUG" \
|
||||
-o "${x}" = "BETTER_BACKTRACES" \
|
||||
-o "${x}" = "BUILD_NATIVE" \
|
||||
-o "${x}" = "COMPILE_DOUBLE" \
|
||||
-o "${x}" = "DEBUG_CHAOS" \
|
||||
-o "${x}" = "DEBUG_SCHEDULER" \
|
||||
-o "${x}" = "DETECT_DEADLOCKS" \
|
||||
-o "${x}" = "DONT_OPTIMIZE" \
|
||||
-o "${x}" = "DUMP_SCHEDULER" \
|
||||
-o "${x}" = "LOTS_OF_SPANS" \
|
||||
-o "${x}" = "MALLOC_DEBUG" \
|
||||
-o "${x}" = "RADIO_RELAX" \
|
||||
-o "${x}" = "REBUILD_PARSERS" \
|
||||
-o "${x}" = "REF_DEBUG" \
|
||||
-o "${x}" = "USE_HOARD_ALLOCATOR" ; then
|
||||
# These options are only for specific sources and have no effect on public ABI.
|
||||
# Keep them out of buildopts.h so ccache does not invalidate all sources.
|
||||
continue
|
||||
fi
|
||||
ADD_CFLAGS_TO_BUILDOPTS=false
|
||||
MENUSELECT_CFLAGS=$(${GREP} -e "^MENUSELECT_CFLAGS" menuselect.makeopts)
|
||||
echo "$MENUSELECT_CFLAGS" | grep -q -e "ADD_CFLAGS_TO_BUILDOPTS_H" && ADD_CFLAGS_TO_BUILDOPTS=true
|
||||
|
||||
# Clean up MENUSELECT_CFLAGS by removing the "MENUSELECT_CFLAGS="
|
||||
# at the front, the "ADD_CFLAGS_TO_BUILDOPTS_H" flag, and any "-D"
|
||||
# entries.
|
||||
MENUSELECT_CFLAGS=$( echo "$MENUSELECT_CFLAGS" | \
|
||||
sed -r -e "s/(MENUSELECT_CFLAGS=|ADD_CFLAGS_TO_BUILDOPTS_H|-D)//g")
|
||||
|
||||
# This is a list of flags that don't affect the ABI.
|
||||
# "ADD_CFLAGS_TO_BUILDOPTS_H" is NOT set, we'll filter these
|
||||
# out of the buildopts.h file.
|
||||
#
|
||||
# These used to always be filtered out but if they're not in
|
||||
# buildopts.h, many IDEs will show them as undefined and mark
|
||||
# any code blocks enabled by them as disabled.
|
||||
#
|
||||
# The original reasoning for removing them was that trivial
|
||||
# changes to the buildopts.h file will cause ccache to
|
||||
# invalidate any source files that use it and increase the
|
||||
# compile time. It's not such a huge deal these days but
|
||||
# to preserve backwards behavior the default is still to
|
||||
# remove them.
|
||||
#
|
||||
# The ABI-breaking flags are always included in buildopts.h.
|
||||
|
||||
# This variable is used by sed so it needs to be a valid
|
||||
# regex which will be surrounded by parens.]
|
||||
FILTER_OUT="\
|
||||
AO2_DEBUG|BETTER_BACKTRACES|BUILD_NATIVE|\
|
||||
COMPILE_DOUBLE|DEBUG_CHAOS|DEBUG_SCHEDULER|\
|
||||
DETECT_DEADLOCKS|DONT_OPTIMIZE|DUMP_SCHEDULER|\
|
||||
LOTS_OF_SPANS|MALLOC_DEBUG|RADIO_RELAX|\
|
||||
REBUILD_PARSERS|REF_DEBUG|USE_HOARD_ALLOCATOR"
|
||||
|
||||
# Create buildopts.h
|
||||
|
||||
INCLUDE_CFLAGS="$MENUSELECT_CFLAGS"
|
||||
# Do the filter-out if needed.
|
||||
if ! $ADD_CFLAGS_TO_BUILDOPTS ; then
|
||||
INCLUDE_CFLAGS=$( echo "$MENUSELECT_CFLAGS" | \
|
||||
sed -r -e "s/(${FILTER_OUT})//g")
|
||||
fi
|
||||
|
||||
# Output the defines.
|
||||
for x in ${INCLUDE_CFLAGS}; do
|
||||
echo "#define ${x} 1"
|
||||
if test "${x}" = "LOW_MEMORY" ; then
|
||||
# LOW_MEMORY isn't an ABI affecting option but it is used in many sources
|
||||
# so it gets defined globally but is not included in AST_BUILTOPTS.
|
||||
continue
|
||||
fi
|
||||
if test "x${BUILDOPTS}" != "x" ; then
|
||||
BUILDOPTS="${BUILDOPTS}, ${x}"
|
||||
else
|
||||
BUILDOPTS="${x}"
|
||||
fi
|
||||
done
|
||||
|
||||
BUILDSUM=`echo ${BUILDOPTS} | ${MD5} | cut -c1-32`
|
||||
# We NEVER include the non-ABI-breaking flags in the
|
||||
# BUILDOPTS or use them to calculate the checksum so
|
||||
# we always filter out any that may exist.
|
||||
# After the filter-out, we also need to convert the
|
||||
# possibly-multi-spaced MENUSELECT_CFLAGS to a nice
|
||||
# comma-separated list.
|
||||
# I.E.
|
||||
# Remove leading spaces.
|
||||
# Convert consecutive interior spaces to a single space.
|
||||
# Remove trailing spaces.
|
||||
# Convert the now-single-spaces in the interior to ", ".
|
||||
BUILDOPTS=$( echo "$MENUSELECT_CFLAGS" | \
|
||||
sed -r -e "s/(${FILTER_OUT}|LOW_MEMORY)//g" -e "s/^\s+//g;s/\s+/ /g;s/\s+$//g;s/\s/, /g" )
|
||||
|
||||
# Calculate the checksum on only the ABI-breaking flags.
|
||||
BUILDSUM=$(echo "${BUILDOPTS}" | ${MD5} | cut -c1-32)
|
||||
|
||||
echo "#define AST_BUILDOPT_SUM \"${BUILDSUM}\""
|
||||
echo "#define AST_BUILDOPTS \"${BUILDOPTS}\""
|
||||
|
||||
# However, it'd be nice to see the non-ABI-breaking flags
|
||||
# when you do a "core show settings" so we create a separate
|
||||
# define for them.
|
||||
BUILDOPTS_ALL=$( echo "$MENUSELECT_CFLAGS" | \
|
||||
sed -r -e "s/^\s+//g;s/\s+/ /g;s/\s+$//g;s/\s/, /g" )
|
||||
echo "#define AST_BUILDOPTS_ALL \"${BUILDOPTS_ALL}\""
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
|
||||
GREP=${GREP:-grep}
|
||||
|
||||
if test ! -f include/asterisk/buildopts.h ; then
|
||||
echo "include/asterisk/buildopts.h is missing"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test ! -f .flavor ; then
|
||||
EXTRA=""
|
||||
elif test ! -f .version ; then
|
||||
|
@ -18,14 +23,11 @@ then
|
|||
BUILDOPTS="AST_DEVMODE"
|
||||
fi
|
||||
|
||||
TMP=`${GREP} -e "^MENUSELECT_CFLAGS" menuselect.makeopts | sed 's/MENUSELECT_CFLAGS\=//g' | sed 's/-D//g'`
|
||||
for x in ${TMP}; do
|
||||
if test "x${BUILDOPTS}" != "x" ; then
|
||||
BUILDOPTS="${BUILDOPTS}, ${x}"
|
||||
else
|
||||
BUILDOPTS="${x}"
|
||||
fi
|
||||
done
|
||||
BUILDOPTS=$(sed -n -r -e 's/#define\s+AST_BUILDOPTS\s+"([^"]+)"/\1/gp' \
|
||||
include/asterisk/buildopts.h )
|
||||
|
||||
BUILDOPTS_ALL=$(sed -n -r -e 's/#define\s+AST_BUILDOPTS_ALL\s+"([^"]+)"/\1/gp' \
|
||||
include/asterisk/buildopts.h )
|
||||
|
||||
cat << END
|
||||
/*
|
||||
|
@ -43,6 +45,8 @@ static const char asterisk_version_num[] = "${ASTERISKVERSIONNUM}";
|
|||
|
||||
static const char asterisk_build_opts[] = "${BUILDOPTS}";
|
||||
|
||||
static const char asterisk_build_opts_all[] = "${BUILDOPTS_ALL}";
|
||||
|
||||
const char *ast_get_version(void)
|
||||
{
|
||||
return asterisk_version;
|
||||
|
@ -58,4 +62,9 @@ const char *ast_get_build_opts(void)
|
|||
return asterisk_build_opts;
|
||||
}
|
||||
|
||||
const char *ast_get_build_opts_all(void)
|
||||
{
|
||||
return asterisk_build_opts_all;
|
||||
}
|
||||
|
||||
END
|
||||
|
|
|
@ -135,12 +135,18 @@ if [ "${for_wiki}" -eq "1" ] || [ "${validate}" -eq "1" ]; then
|
|||
fi
|
||||
fi
|
||||
|
||||
make_absolute() {
|
||||
case "$1" in
|
||||
/*) echo "$1" ;;
|
||||
*) echo "$source_tree/$1" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
if [ "${command}" = "print_dependencies" ] ; then
|
||||
for subdir in ${mod_subdirs} ; do
|
||||
subpath="${source_tree}/${subdir}"
|
||||
# We WANT word splitting in the following line.
|
||||
# shellcheck disable=SC2046
|
||||
${GREP} -l -E '(language="en_US"|appdocsxml.dtd)' $(${FIND} "${subpath}" -name '*.c' -or -name '*.cc' -or -name '*.xml') || :
|
||||
subpath=$(make_absolute "$subdir")
|
||||
${FIND} "${subpath}" \( -name '*.c' -o -name '*.cc' -o -name '*.xml' \) \
|
||||
-exec ${GREP} -l -E '(language="en_US"|appdocsxml.dtd)' '{}' \;
|
||||
done
|
||||
exit
|
||||
fi
|
||||
|
@ -186,7 +192,7 @@ printf "Building Documentation For: "
|
|||
|
||||
for subdir in ${mod_subdirs} ; do
|
||||
printf "%s " "${subdir}"
|
||||
subdir_path="${source_tree}/${subdir}"
|
||||
subdir_path=$(make_absolute "$subdir")
|
||||
for i in $(${FIND} "${subdir_path}" -name '*.c' -or -name '*.cc'); do
|
||||
if [ "${with_moduleinfo}" -eq "1" ] ; then
|
||||
MODULEINFO=$(${AWK} -f "${source_tree}/build_tools/get_moduleinfo" "${i}")
|
||||
|
|
|
@ -28,6 +28,7 @@ URIPARSER=@PBX_URIPARSER@
|
|||
KQUEUE=@PBX_KQUEUE@
|
||||
LDAP=@PBX_LDAP@
|
||||
LIBEDIT=@PBX_LIBEDIT@
|
||||
LIBJWT=@PBX_LIBJWT@
|
||||
LIBXML2=@PBX_LIBXML2@
|
||||
LIBXSLT=@PBX_LIBXSLT@
|
||||
XMLSTARLET=@PBX_XMLSTARLET@
|
||||
|
|
|
@ -152,6 +152,8 @@ static struct console_pvt {
|
|||
struct ast_frame fr;
|
||||
/*! Running = 1, Not running = 0 */
|
||||
unsigned int streamstate:1;
|
||||
/*! Abort stream processing? */
|
||||
unsigned int abort:1;
|
||||
/*! On-hook = 0, Off-hook = 1 */
|
||||
unsigned int hookstate:1;
|
||||
/*! Unmuted = 0, Muted = 1 */
|
||||
|
@ -275,18 +277,19 @@ static void *stream_monitor(void *data)
|
|||
};
|
||||
|
||||
for (;;) {
|
||||
pthread_testcancel();
|
||||
console_pvt_lock(pvt);
|
||||
res = Pa_ReadStream(pvt->stream, buf, sizeof(buf) / sizeof(int16_t));
|
||||
console_pvt_unlock(pvt);
|
||||
pthread_testcancel();
|
||||
|
||||
if (!pvt->owner) {
|
||||
if (!pvt->owner || pvt->abort) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (res == paNoError)
|
||||
if (res == paNoError) {
|
||||
ast_queue_frame(pvt->owner, &f);
|
||||
} else {
|
||||
ast_log(LOG_WARNING, "Console ReadStream failed: %s\n", Pa_GetErrorText(res));
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
@ -401,8 +404,9 @@ static int stop_stream(struct console_pvt *pvt)
|
|||
if (!pvt->streamstate || pvt->thread == AST_PTHREADT_NULL)
|
||||
return 0;
|
||||
|
||||
pthread_cancel(pvt->thread);
|
||||
pthread_kill(pvt->thread, SIGURG);
|
||||
pvt->abort = 1;
|
||||
/* Wait for pvt->thread to exit cleanly, to avoid killing it while it's holding a lock. */
|
||||
pthread_kill(pvt->thread, SIGURG); /* Wake it up if needed, but don't cancel it */
|
||||
pthread_join(pvt->thread, NULL);
|
||||
|
||||
console_pvt_lock(pvt);
|
||||
|
|
|
@ -263,6 +263,10 @@
|
|||
</enum>
|
||||
<enum name="dialmode">
|
||||
<para>R/W Pulse and tone dialing mode of the channel.</para>
|
||||
<para>Disabling tone dialing using this option will not disable the DSP used for DTMF detection.
|
||||
To do that, also set the <literal>digitdetect</literal> option. If digit detection is disabled,
|
||||
DTMF will not be detected, regardless of the <literal>dialmode</literal> setting.
|
||||
The <literal>digitdetect</literal> setting has no impact on pulse dialing detection.</para>
|
||||
<para>If set, overrides the setting in <literal>chan_dahdi.conf</literal> for that channel.</para>
|
||||
<enumlist>
|
||||
<enum name="both" />
|
||||
|
@ -272,6 +276,21 @@
|
|||
<enum name="none" />
|
||||
</enumlist>
|
||||
</enum>
|
||||
<enum name="waitfordialtone">
|
||||
<para>W/O Duration in ms for which to wait for dial tone on the current call.</para>
|
||||
<para>This setting is will temporarily override the <literal>waitfordialtone</literal>
|
||||
setting in <literal>chan_dahdi.conf</literal> (typically if that setting is disabled).
|
||||
You must call this in a pre-dial handler when making a call on an analog trunk
|
||||
(e.g. FXS-signalled interface).</para>
|
||||
<para>This allows, for example, being able to barge in on an in-use trunk,
|
||||
if dialed specifically, but allows skipping the trunk when routing calls
|
||||
if dial tone is not present on a channel.</para>
|
||||
<para>This setting will only apply to the current (next) call made on the
|
||||
DAHDI channel, and will not persist for future calls.</para>
|
||||
<para>Please keep in mind that due to the way that chan_dahdi implements dial tone detection,
|
||||
DTMF digits on an in-use channel will temporarily relay to any other channels attempting to use the channel for a call.
|
||||
However, voice transmission will not leak.</para>
|
||||
</enum>
|
||||
</enumlist>
|
||||
</info>
|
||||
<info name="Dial_Resource" language="en_US" tech="DAHDI">
|
||||
|
@ -2024,6 +2043,9 @@ static void my_set_cadence(void *pvt, int *cid_rings, struct ast_channel *ast)
|
|||
ast_log(LOG_WARNING, "Unable to set distinctive ring cadence %d on '%s': %s\n", p->distinctivering, ast_channel_name(ast), strerror(errno));
|
||||
*cid_rings = cidrings[p->distinctivering - 1];
|
||||
} else {
|
||||
if (p->distinctivering > 0) {
|
||||
ast_log(LOG_WARNING, "Cadence %d is not defined, falling back to default ring cadence\n", p->distinctivering);
|
||||
}
|
||||
if (ioctl(p->subs[SUB_REAL].dfd, DAHDI_SETCADENCE, NULL))
|
||||
ast_log(LOG_WARNING, "Unable to reset default ring on '%s': %s\n", ast_channel_name(ast), strerror(errno));
|
||||
*cid_rings = p->sendcalleridafter;
|
||||
|
@ -2097,11 +2119,40 @@ static void my_set_waitingfordt(void *pvt, struct ast_channel *ast)
|
|||
{
|
||||
struct dahdi_pvt *p = pvt;
|
||||
|
||||
if (p->waitfordialtone && CANPROGRESSDETECT(p) && p->dsp) {
|
||||
ast_debug(1, "Defer dialing for %dms or dialtone\n", p->waitfordialtone);
|
||||
gettimeofday(&p->waitingfordt, NULL);
|
||||
ast_setstate(ast, AST_STATE_OFFHOOK);
|
||||
/* We reset p->waitfordialtonetemp here, to prevent leaking to future calls,
|
||||
* but we also need to check against this value until we get dialtone
|
||||
* or the timer expires, since waitingfordt is when the timer started,
|
||||
* not when it should expire.
|
||||
*
|
||||
* Critically, we only set p->waitingfordt here if waitfordialtone or waitfordialtonetemp
|
||||
* has already been set, as waitingfordt is what is checked at runtime to determine
|
||||
* if we should be waiting for dial tone. This ensures that if a second call
|
||||
* is initiated concurrently, the first one "consumes" waitfordialtonetemp and resets it,
|
||||
* preventing leaking to other calls while remaining available to check on the first one while dialing.
|
||||
*/
|
||||
p->waitfordialtoneduration = p->waitfordialtonetemp ? p->waitfordialtonetemp : p->waitfordialtone;
|
||||
p->waitfordialtonetemp = 0;
|
||||
|
||||
if (!(p->waitfordialtoneduration && CANPROGRESSDETECT(p))) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Because the DSP is allocated when the channel is created,
|
||||
* if we requested waitfordialtone later (in a predial handler),
|
||||
* we need to create it now */
|
||||
if (!p->dsp) {
|
||||
p->dsp = ast_dsp_new();
|
||||
if (!p->dsp) {
|
||||
ast_log(LOG_ERROR, "Unable to allocate DSP\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
p->dsp_features |= DSP_FEATURE_WAITDIALTONE;
|
||||
ast_dsp_set_features(p->dsp, p->dsp_features);
|
||||
|
||||
ast_debug(1, "Defer dialing for %dms or dialtone\n", p->waitfordialtoneduration);
|
||||
gettimeofday(&p->waitingfordt, NULL);
|
||||
ast_setstate(ast, AST_STATE_OFFHOOK);
|
||||
}
|
||||
|
||||
static int my_check_waitingfordt(void *pvt)
|
||||
|
@ -5223,6 +5274,18 @@ static int has_voicemail(struct dahdi_pvt *p)
|
|||
int new_msgs;
|
||||
RAII_VAR(struct stasis_message *, mwi_message, NULL, ao2_cleanup);
|
||||
|
||||
/* A manual MWI disposition has been requested, use that instead
|
||||
* if this is for sending the new MWI indication. */
|
||||
if (p->mwioverride_active) {
|
||||
/* We don't clear p->mwioverride_active automatically,
|
||||
* because otherwise do_monitor would just change it back to the way it was.
|
||||
* We need to keep the override active until explicitly disabled by the user,
|
||||
* so that we can keep returning the correct answer in subsequent calls to do_monitor. */
|
||||
ast_debug(6, "MWI manual override active on channel %d: pretending that it should be %s\n",
|
||||
p->channel, p->mwioverride_disposition ? "active" : "inactive");
|
||||
return p->mwioverride_disposition;
|
||||
}
|
||||
|
||||
mwi_message = stasis_cache_get(ast_mwi_state_cache(), ast_mwi_state_type(), p->mailbox);
|
||||
if (mwi_message) {
|
||||
struct ast_mwi_state *mwi_state = stasis_message_data(mwi_message);
|
||||
|
@ -6719,6 +6782,14 @@ static int dahdi_queryoption(struct ast_channel *chan, int option, void *data, i
|
|||
}
|
||||
|
||||
switch (option) {
|
||||
case AST_OPTION_TDD:
|
||||
cp = (char *) data;
|
||||
if (p->mate) {
|
||||
*cp = 2;
|
||||
} else {
|
||||
*cp = p->tdd ? 1 : 0;
|
||||
}
|
||||
break;
|
||||
case AST_OPTION_DIGIT_DETECT:
|
||||
cp = (char *) data;
|
||||
*cp = p->ignoredtmf ? 0 : 1;
|
||||
|
@ -7227,6 +7298,21 @@ static int dahdi_func_write(struct ast_channel *chan, const char *function, char
|
|||
res = -1;
|
||||
}
|
||||
ast_mutex_unlock(&p->lock);
|
||||
} else if (!strcasecmp(data, "waitfordialtone")) {
|
||||
if (ast_strlen_zero(value)) {
|
||||
ast_log(LOG_WARNING, "waitfordialtone requires a duration in ms\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
ast_mutex_lock(&p->lock);
|
||||
if (!CANPROGRESSDETECT(p)) {
|
||||
ast_log(LOG_WARNING, "%s only supported on analog trunks\n", data);
|
||||
ast_mutex_unlock(&p->lock);
|
||||
return -1;
|
||||
}
|
||||
/* Only set the temp waitfordialtone setting, not the permanent one. */
|
||||
p->waitfordialtonetemp = atoi(value);
|
||||
ast_mutex_unlock(&p->lock);
|
||||
} else {
|
||||
res = -1;
|
||||
}
|
||||
|
@ -9066,9 +9152,9 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast)
|
|||
/* DSP clears us of being pulse */
|
||||
p->pulsedial = 0;
|
||||
} else if (p->waitingfordt.tv_sec) {
|
||||
if (ast_tvdiff_ms(ast_tvnow(), p->waitingfordt) >= p->waitfordialtone ) {
|
||||
if (ast_tvdiff_ms(ast_tvnow(), p->waitingfordt) >= p->waitfordialtoneduration) {
|
||||
p->waitingfordt.tv_sec = 0;
|
||||
ast_log(LOG_WARNING, "Never saw dialtone on channel %d\n", p->channel);
|
||||
ast_log(LOG_NOTICE, "Never saw dialtone on channel %d\n", p->channel);
|
||||
ast_frfree(f);
|
||||
f = NULL;
|
||||
} else if (f->frametype == AST_FRAME_VOICE) {
|
||||
|
@ -11874,7 +11960,7 @@ static void *do_monitor(void *data)
|
|||
&& (last->sig & __DAHDI_SIG_FXO)
|
||||
&& !analog_p->fxsoffhookstate
|
||||
&& !last->owner
|
||||
&& !ast_strlen_zero(last->mailbox)
|
||||
&& (!ast_strlen_zero(last->mailbox) || last->mwioverride_active)
|
||||
&& !analog_p->subs[SUB_REAL].owner /* could be a recall ring from a flash hook hold */
|
||||
&& (thispass - analog_p->onhooktime > 3)) {
|
||||
res = has_voicemail(last);
|
||||
|
@ -12949,6 +13035,7 @@ static struct dahdi_pvt *mkintf(int channel, const struct dahdi_chan_conf *conf,
|
|||
tmp->callwaitingcallerid = conf->chan.callwaitingcallerid;
|
||||
tmp->threewaycalling = conf->chan.threewaycalling;
|
||||
tmp->threewaysilenthold = conf->chan.threewaysilenthold;
|
||||
tmp->calledsubscriberheld = conf->chan.calledsubscriberheld; /* Not used in chan_dahdi.c, just analog pvt, but must exist on the DAHDI pvt anyways */
|
||||
tmp->adsi = conf->chan.adsi;
|
||||
tmp->use_smdi = conf->chan.use_smdi;
|
||||
tmp->permhidecallerid = conf->chan.hidecallerid;
|
||||
|
@ -13247,6 +13334,7 @@ static struct dahdi_pvt *mkintf(int channel, const struct dahdi_chan_conf *conf,
|
|||
analog_p->ani_wink_time = conf->chan.ani_wink_time;
|
||||
analog_p->hanguponpolarityswitch = conf->chan.hanguponpolarityswitch;
|
||||
analog_p->permcallwaiting = conf->chan.callwaiting; /* permcallwaiting possibly modified in analog_config_complete */
|
||||
analog_p->calledsubscriberheld = conf->chan.calledsubscriberheld; /* Only actually used in analog pvt, not DAHDI pvt */
|
||||
analog_p->callreturn = conf->chan.callreturn;
|
||||
analog_p->cancallforward = conf->chan.cancallforward;
|
||||
analog_p->canpark = conf->chan.canpark;
|
||||
|
@ -16524,6 +16612,75 @@ static char *dahdi_set_dnd(struct ast_cli_entry *e, int cmd, struct ast_cli_args
|
|||
return CLI_SUCCESS;
|
||||
}
|
||||
|
||||
static char *dahdi_set_mwi(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
||||
{
|
||||
int channel;
|
||||
int on;
|
||||
int override = 1;
|
||||
struct dahdi_pvt *dahdi_chan = NULL;
|
||||
|
||||
switch (cmd) {
|
||||
case CLI_INIT:
|
||||
e->command = "dahdi set mwi";
|
||||
e->usage =
|
||||
"Usage: dahdi set mwi <chan#> <on|off|reset>\n"
|
||||
" Sets/unsets MWI (Message Waiting Indicator) manually on a channel.\n"
|
||||
" This may be used regardless of whether the channel is assigned any mailboxes.\n"
|
||||
" When active, this setting will override the voicemail status to set MWI.\n"
|
||||
" Once cleared, the voicemail status will resume control of MWI.\n"
|
||||
" Changes are queued for when the channel is idle and persist until cleared.\n"
|
||||
" <chan num> is the channel number\n"
|
||||
" <on|off|reset> Enable, disable, or reset Message Waiting Indicator override?\n"
|
||||
;
|
||||
return NULL;
|
||||
case CLI_GENERATE:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (a->argc != 5)
|
||||
return CLI_SHOWUSAGE;
|
||||
|
||||
if ((channel = atoi(a->argv[3])) <= 0) {
|
||||
ast_cli(a->fd, "Expected channel number, got '%s'\n", a->argv[3]);
|
||||
return CLI_SHOWUSAGE;
|
||||
}
|
||||
|
||||
if (ast_true(a->argv[4])) {
|
||||
on = 1;
|
||||
} else if (ast_false(a->argv[4])) {
|
||||
on = 0;
|
||||
} else if (!strcmp(a->argv[4], "reset")) {
|
||||
override = 0;
|
||||
} else {
|
||||
ast_cli(a->fd, "Expected 'on' or 'off' or 'reset', got '%s'\n", a->argv[4]);
|
||||
return CLI_SHOWUSAGE;
|
||||
}
|
||||
|
||||
ast_mutex_lock(&iflock);
|
||||
for (dahdi_chan = iflist; dahdi_chan; dahdi_chan = dahdi_chan->next) {
|
||||
if (dahdi_chan->channel != channel)
|
||||
continue;
|
||||
|
||||
/* Found the channel. Actually set it */
|
||||
if (override) {
|
||||
dahdi_chan->mwioverride_disposition = on;
|
||||
ast_cli(a->fd, "MWI '%s' queued for channel %d\n", on ? "enable" : "disable", channel);
|
||||
}
|
||||
dahdi_chan->mwioverride_active = override;
|
||||
/* The do_monitor thread will take care of actually sending the MWI
|
||||
* at an appropriate time for the channel. */
|
||||
break;
|
||||
}
|
||||
ast_mutex_unlock(&iflock);
|
||||
|
||||
if (!dahdi_chan) {
|
||||
ast_cli(a->fd, "Unable to find given channel %d\n", channel);
|
||||
return CLI_FAILURE;
|
||||
}
|
||||
|
||||
return CLI_SUCCESS;
|
||||
}
|
||||
|
||||
static struct ast_cli_entry dahdi_cli[] = {
|
||||
AST_CLI_DEFINE(handle_dahdi_show_cadences, "List cadences"),
|
||||
AST_CLI_DEFINE(dahdi_show_channels, "Show active DAHDI channels"),
|
||||
|
@ -16536,6 +16693,7 @@ static struct ast_cli_entry dahdi_cli[] = {
|
|||
AST_CLI_DEFINE(dahdi_set_hwgain, "Set hardware gain on a channel"),
|
||||
AST_CLI_DEFINE(dahdi_set_swgain, "Set software gain on a channel"),
|
||||
AST_CLI_DEFINE(dahdi_set_dnd, "Sets/resets DND (Do Not Disturb) mode on a channel"),
|
||||
AST_CLI_DEFINE(dahdi_set_mwi, "Sets/unsets MWI (Message Waiting Indicator) manually on a channel"),
|
||||
};
|
||||
|
||||
#define TRANSFER 0
|
||||
|
@ -18341,6 +18499,8 @@ static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct
|
|||
confp->chan.busycount = atoi(v->value);
|
||||
} else if (!strcasecmp(v->name, "busypattern")) {
|
||||
parse_busy_pattern(v, &confp->chan.busy_cadence);
|
||||
} else if (!strcasecmp(v->name, "calledsubscriberheld")) {
|
||||
confp->chan.calledsubscriberheld = ast_true(v->value);
|
||||
} else if (!strcasecmp(v->name, "callprogress")) {
|
||||
confp->chan.callprogress &= ~CALLPROGRESS_PROGRESS;
|
||||
if (ast_true(v->value))
|
||||
|
@ -18430,18 +18590,30 @@ static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct
|
|||
} else if (!strcasecmp(v->name, "group")) {
|
||||
confp->chan.group = ast_get_group(v->value);
|
||||
} else if (!strcasecmp(v->name, "callgroup")) {
|
||||
if (!((confp->chan.sig == SIG_FXOKS) || (confp->chan.sig == SIG_FXOGS) || (confp->chan.sig == SIG_FXOLS))) {
|
||||
ast_log(LOG_WARNING, "Only FXO signalled channels may belong to a call group\n");
|
||||
}
|
||||
if (!strcasecmp(v->value, "none"))
|
||||
confp->chan.callgroup = 0;
|
||||
else
|
||||
confp->chan.callgroup = ast_get_group(v->value);
|
||||
} else if (!strcasecmp(v->name, "pickupgroup")) {
|
||||
if (!((confp->chan.sig == SIG_FXOKS) || (confp->chan.sig == SIG_FXOGS) || (confp->chan.sig == SIG_FXOLS))) {
|
||||
ast_log(LOG_WARNING, "Only FXO signalled channels may belong to a pickup group\n");
|
||||
}
|
||||
if (!strcasecmp(v->value, "none"))
|
||||
confp->chan.pickupgroup = 0;
|
||||
else
|
||||
confp->chan.pickupgroup = ast_get_group(v->value);
|
||||
} else if (!strcasecmp(v->name, "namedcallgroup")) {
|
||||
if (!((confp->chan.sig == SIG_FXOKS) || (confp->chan.sig == SIG_FXOGS) || (confp->chan.sig == SIG_FXOLS))) {
|
||||
ast_log(LOG_WARNING, "Only FXO signalled channels may belong to a named call group\n");
|
||||
}
|
||||
confp->chan.named_callgroups = ast_get_namedgroups(v->value);
|
||||
} else if (!strcasecmp(v->name, "namedpickupgroup")) {
|
||||
if (!((confp->chan.sig == SIG_FXOKS) || (confp->chan.sig == SIG_FXOGS) || (confp->chan.sig == SIG_FXOLS))) {
|
||||
ast_log(LOG_WARNING, "Only FXO signalled channels may belong to a named pickup group\n");
|
||||
}
|
||||
confp->chan.named_pickupgroups = ast_get_namedgroups(v->value);
|
||||
} else if (!strcasecmp(v->name, "setvar")) {
|
||||
if (v->value) {
|
||||
|
|
|
@ -204,6 +204,13 @@ struct dahdi_pvt {
|
|||
* \note Set from the "busydetect" value read in from chan_dahdi.conf
|
||||
*/
|
||||
unsigned int busydetect:1;
|
||||
/*!
|
||||
* \brief TRUE if Called Subscriber held is enabled.
|
||||
* This allows a single incoming call to hold a DAHDI channel up,
|
||||
* allowing a recipient to hang up an extension and pick up another
|
||||
* phone on the same line without disconnecting the call.
|
||||
*/
|
||||
unsigned int calledsubscriberheld:1;
|
||||
/*!
|
||||
* \brief TRUE if call return is enabled.
|
||||
* (*69, if your dialplan doesn't catch this first)
|
||||
|
@ -424,6 +431,10 @@ struct dahdi_pvt {
|
|||
unsigned int mwimonitoractive:1;
|
||||
/*! \brief TRUE if a MWI message sending thread is active */
|
||||
unsigned int mwisendactive:1;
|
||||
/*! \brief TRUE if a manual MWI override is active for a channel */
|
||||
unsigned int mwioverride_active:1;
|
||||
/*! \brief Manual MWI disposition (on/off) */
|
||||
unsigned int mwioverride_disposition:1;
|
||||
/*!
|
||||
* \brief TRUE if channel is out of reset and ready
|
||||
* \note Used by SS7. Otherwise set but not used.
|
||||
|
@ -643,6 +654,14 @@ struct dahdi_pvt {
|
|||
* \note Set from the "waitfordialtone" value read in from chan_dahdi.conf
|
||||
*/
|
||||
int waitfordialtone;
|
||||
/*!
|
||||
* \brief Transient variable. Same as waitfordialtone, but temporarily set for a specific call, rather than permanently for the channel.
|
||||
*/
|
||||
int waitfordialtonetemp;
|
||||
/*!
|
||||
* \brief Transient variable. Stored off waitfordialtone duration at runtime.
|
||||
*/
|
||||
int waitfordialtoneduration;
|
||||
/*!
|
||||
* \brief Number of frames to watch for dialtone in incoming calls
|
||||
* \note Set from the "dialtone_detect" value read in from chan_dahdi.conf
|
||||
|
|
|
@ -398,6 +398,47 @@ static int (*iax2_regfunk)(const char *username, int onoff) = NULL;
|
|||
#define DEFAULT_FREQ_OK 60 * 1000 /* How often to check for the host to be up */
|
||||
#define DEFAULT_FREQ_NOTOK 10 * 1000 /* How often to check, if the host is down... */
|
||||
|
||||
/*! \brief Name of effective auth method */
|
||||
static const char *auth_method_labels[] = {
|
||||
[0] = "none",
|
||||
[IAX_AUTH_PLAINTEXT] = "plaintext",
|
||||
[IAX_AUTH_MD5] = "MD5",
|
||||
[IAX_AUTH_RSA] = "RSA",
|
||||
};
|
||||
|
||||
/* Max length is length of |RSA|MD5|plaintext (18 + 1 for NUL = 19) */
|
||||
#define AUTH_METHOD_NAMES_BUFSIZE 19
|
||||
|
||||
/*!
|
||||
* \brief Get names of all auth methods
|
||||
* \param Bit field of auth methods
|
||||
* \param[out] buf Buffer into which to write the names. Must be of size AUTH_METHOD_NAMES_BUFSIZE.
|
||||
* \return Auth methods name
|
||||
*/
|
||||
static char *auth_method_names(int authmethods, char *restrict buf)
|
||||
{
|
||||
char *pos = buf;
|
||||
|
||||
*pos = '\0';
|
||||
|
||||
if (authmethods & IAX_AUTH_RSA) {
|
||||
pos += sprintf(pos, "|RSA");
|
||||
}
|
||||
if (authmethods & IAX_AUTH_MD5) {
|
||||
pos += sprintf(pos, "|MD5");
|
||||
}
|
||||
if (authmethods & IAX_AUTH_PLAINTEXT) {
|
||||
pos += sprintf(pos, "|plaintext");
|
||||
}
|
||||
|
||||
if (pos == buf) { /* No auth methods */
|
||||
strcpy(buf, "none");
|
||||
return buf;
|
||||
}
|
||||
|
||||
return buf + 1; /* Skip leading | */
|
||||
}
|
||||
|
||||
/* if a pvt has encryption setup done and is running on the call */
|
||||
#define IAX_CALLENCRYPTED(pvt) \
|
||||
(ast_test_flag64(pvt, IAX_ENCRYPTED) && ast_test_flag64(pvt, IAX_KEYPOPULATED))
|
||||
|
@ -825,6 +866,8 @@ struct chan_iax2_pvt {
|
|||
int authrej;
|
||||
/*! permitted authentication methods */
|
||||
int authmethods;
|
||||
/*! effective authentication method */
|
||||
int eff_auth_method;
|
||||
/*! permitted encryption methods */
|
||||
int encmethods;
|
||||
/*! Encryption AES-128 Key */
|
||||
|
@ -8189,7 +8232,7 @@ static int authenticate_verify(struct chan_iax2_pvt *p, struct iax_ies *ies)
|
|||
user = user_unref(user);
|
||||
}
|
||||
if (ast_test_flag64(p, IAX_FORCE_ENCRYPT) && !p->encmethods) {
|
||||
ast_log(LOG_NOTICE, "Call Terminated, Incoming call is unencrypted while force encrypt is enabled.\n");
|
||||
ast_log(LOG_WARNING, "Call Terminated, incoming call is unencrypted while force encrypt is enabled.\n");
|
||||
return res;
|
||||
}
|
||||
if (!ast_test_flag(&p->state, IAX_STATE_AUTHENTICATED))
|
||||
|
@ -8215,12 +8258,17 @@ static int authenticate_verify(struct chan_iax2_pvt *p, struct iax_ies *ies)
|
|||
key = ast_key_get(keyn, AST_KEY_PUBLIC);
|
||||
if (key && !ast_check_signature(key, p->challenge, rsasecret)) {
|
||||
res = 0;
|
||||
p->eff_auth_method = IAX_AUTH_RSA;
|
||||
break;
|
||||
} else if (!key)
|
||||
ast_log(LOG_WARNING, "requested inkey '%s' for RSA authentication does not exist\n", keyn);
|
||||
} else if (!key) {
|
||||
ast_log(LOG_WARNING, "Requested inkey '%s' for RSA authentication does not exist\n", keyn);
|
||||
}
|
||||
keyn = strsep(&stringp, ":");
|
||||
}
|
||||
ast_free(tmpkey);
|
||||
if (res && authdebug) {
|
||||
ast_log(LOG_WARNING, "No RSA public keys on file matched incoming call\n");
|
||||
}
|
||||
} else if (p->authmethods & IAX_AUTH_MD5) {
|
||||
struct MD5Context md5;
|
||||
unsigned char digest[16];
|
||||
|
@ -8237,12 +8285,19 @@ static int authenticate_verify(struct chan_iax2_pvt *p, struct iax_ies *ies)
|
|||
sprintf(requeststr + (x << 1), "%02hhx", digest[x]); /* safe */
|
||||
if (!strcasecmp(requeststr, md5secret)) {
|
||||
res = 0;
|
||||
p->eff_auth_method = IAX_AUTH_MD5;
|
||||
break;
|
||||
} else if (authdebug) {
|
||||
ast_log(LOG_WARNING, "MD5 secret mismatch\n");
|
||||
}
|
||||
}
|
||||
} else if (p->authmethods & IAX_AUTH_PLAINTEXT) {
|
||||
if (!strcmp(secret, p->secret))
|
||||
if (!strcmp(secret, p->secret)) {
|
||||
res = 0;
|
||||
p->eff_auth_method = IAX_AUTH_PLAINTEXT;
|
||||
} else if (authdebug) {
|
||||
ast_log(LOG_WARNING, "Plaintext secret mismatch\n");
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
@ -8417,22 +8472,25 @@ static int authenticate(const char *challenge, const char *secret, const char *k
|
|||
if (!ast_strlen_zero(keyn)) {
|
||||
if (!(authmethods & IAX_AUTH_RSA)) {
|
||||
if (ast_strlen_zero(secret)) {
|
||||
ast_log(LOG_NOTICE, "Asked to authenticate to %s with an RSA key, but they don't allow RSA authentication\n", ast_sockaddr_stringify_addr(addr));
|
||||
ast_log(LOG_WARNING, "Asked to authenticate to %s with an RSA key, but they don't allow RSA authentication\n", ast_sockaddr_stringify_addr(addr));
|
||||
}
|
||||
} else if (ast_strlen_zero(challenge)) {
|
||||
ast_log(LOG_NOTICE, "No challenge provided for RSA authentication to %s\n", ast_sockaddr_stringify_addr(addr));
|
||||
ast_log(LOG_WARNING, "No challenge provided for RSA authentication to %s\n", ast_sockaddr_stringify_addr(addr));
|
||||
} else {
|
||||
char sig[256];
|
||||
struct ast_key *key;
|
||||
key = ast_key_get(keyn, AST_KEY_PRIVATE);
|
||||
if (!key) {
|
||||
ast_log(LOG_NOTICE, "Unable to find private key '%s'\n", keyn);
|
||||
ast_log(LOG_WARNING, "Unable to find private key '%s'\n", keyn);
|
||||
} else {
|
||||
if (ast_sign(key, (char*)challenge, sig)) {
|
||||
ast_log(LOG_NOTICE, "Unable to sign challenge with key\n");
|
||||
ast_log(LOG_WARNING, "Unable to sign challenge with key\n");
|
||||
res = -1;
|
||||
} else {
|
||||
iax_ie_append_str(ied, IAX_IE_RSA_RESULT, sig);
|
||||
if (pvt) {
|
||||
pvt->eff_auth_method = IAX_AUTH_RSA;
|
||||
}
|
||||
res = 0;
|
||||
}
|
||||
}
|
||||
|
@ -8465,11 +8523,15 @@ static int authenticate(const char *challenge, const char *secret, const char *k
|
|||
sprintf(digres + (x << 1), "%02hhx", digest[x]); /* safe */
|
||||
if (pvt) {
|
||||
build_encryption_keys(digest, pvt);
|
||||
pvt->eff_auth_method = IAX_AUTH_MD5;
|
||||
}
|
||||
iax_ie_append_str(ied, IAX_IE_MD5_RESULT, digres);
|
||||
res = 0;
|
||||
} else if (authmethods & IAX_AUTH_PLAINTEXT) {
|
||||
iax_ie_append_str(ied, IAX_IE_PASSWORD, secret);
|
||||
if (pvt) {
|
||||
pvt->eff_auth_method = IAX_AUTH_PLAINTEXT;
|
||||
}
|
||||
res = 0;
|
||||
} else
|
||||
ast_log(LOG_WARNING, "No way to send secret to peer '%s' (their methods: %d)\n", ast_sockaddr_stringify_addr(addr), authmethods);
|
||||
|
@ -11311,7 +11373,7 @@ static int socket_process_helper(struct iax2_thread *thread)
|
|||
}
|
||||
if (authenticate_verify(iaxs[fr->callno], &ies)) {
|
||||
if (authdebug)
|
||||
ast_log(LOG_NOTICE, "Host %s failed to authenticate as %s\n", ast_sockaddr_stringify(&addr),
|
||||
ast_log(LOG_WARNING, "Host %s failed to authenticate as %s\n", ast_sockaddr_stringify(&addr),
|
||||
iaxs[fr->callno]->username);
|
||||
memset(&ied0, 0, sizeof(ied0));
|
||||
auth_fail(fr->callno, IAX_COMMAND_REJECT);
|
||||
|
@ -11324,7 +11386,7 @@ static int socket_process_helper(struct iax2_thread *thread)
|
|||
exists = 0;
|
||||
if (strcmp(iaxs[fr->callno]->exten, "TBD") && !exists) {
|
||||
if (authdebug)
|
||||
ast_log(LOG_NOTICE, "Rejected connect attempt from %s, request '%s@%s' does not exist\n",
|
||||
ast_log(LOG_WARNING, "Rejected connect attempt from %s, request '%s@%s' does not exist\n",
|
||||
ast_sockaddr_stringify(&addr),
|
||||
iaxs[fr->callno]->exten,
|
||||
iaxs[fr->callno]->context);
|
||||
|
@ -11379,12 +11441,12 @@ static int socket_process_helper(struct iax2_thread *thread)
|
|||
if (!format) {
|
||||
if (authdebug) {
|
||||
if (ast_test_flag64(iaxs[fr->callno], IAX_CODEC_NOCAP)) {
|
||||
ast_log(LOG_NOTICE, "Rejected connect attempt from %s, requested '%s' incompatible with our capability '%s'.\n",
|
||||
ast_log(LOG_WARNING, "Rejected connect attempt from %s, requested '%s' incompatible with our capability '%s'.\n",
|
||||
ast_sockaddr_stringify(&addr),
|
||||
iax2_getformatname_multiple(iaxs[fr->callno]->peerformat, &peer_form_buf),
|
||||
iax2_getformatname_multiple(iaxs[fr->callno]->capability, &cap_buf));
|
||||
} else {
|
||||
ast_log(LOG_NOTICE, "Rejected connect attempt from %s, requested/capability '%s'/'%s' incompatible with our capability '%s'.\n",
|
||||
ast_log(LOG_WARNING, "Rejected connect attempt from %s, requested/capability '%s'/'%s' incompatible with our capability '%s'.\n",
|
||||
ast_sockaddr_stringify(&addr),
|
||||
iax2_getformatname_multiple(iaxs[fr->callno]->peerformat, &peer_form_buf),
|
||||
iax2_getformatname_multiple(iaxs[fr->callno]->peercapability, &peer_buf),
|
||||
|
@ -11437,12 +11499,12 @@ static int socket_process_helper(struct iax2_thread *thread)
|
|||
iax2_getformatname_multiple(iaxs[fr->callno]->peercapability & iaxs[fr->callno]->capability, &cap_buf));
|
||||
if (authdebug) {
|
||||
if (ast_test_flag64(iaxs[fr->callno], IAX_CODEC_NOCAP)) {
|
||||
ast_log(LOG_NOTICE, "Rejected connect attempt from %s, requested '%s' incompatible with our capability '%s'.\n",
|
||||
ast_log(LOG_WARNING, "Rejected connect attempt from %s, requested '%s' incompatible with our capability '%s'.\n",
|
||||
ast_sockaddr_stringify(&addr),
|
||||
iax2_getformatname_multiple(iaxs[fr->callno]->peerformat, &peer_form_buf),
|
||||
iax2_getformatname_multiple(iaxs[fr->callno]->capability, &cap_buf));
|
||||
} else {
|
||||
ast_log(LOG_NOTICE, "Rejected connect attempt from %s, requested/capability '%s'/'%s' incompatible with our capability '%s'.\n",
|
||||
ast_log(LOG_WARNING, "Rejected connect attempt from %s, requested/capability '%s'/'%s' incompatible with our capability '%s'.\n",
|
||||
ast_sockaddr_stringify(&addr),
|
||||
iax2_getformatname_multiple(iaxs[fr->callno]->peerformat, &peer_form_buf),
|
||||
iax2_getformatname_multiple(iaxs[fr->callno]->peercapability, &peer_buf),
|
||||
|
@ -11466,8 +11528,12 @@ static int socket_process_helper(struct iax2_thread *thread)
|
|||
iax_ie_append_versioned_uint64(&ied1, IAX_IE_FORMAT2, 0, format);
|
||||
send_command(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_ACCEPT, 0, ied1.buf, ied1.pos, -1);
|
||||
if (strcmp(iaxs[fr->callno]->exten, "TBD")) {
|
||||
char authmethodnames[AUTH_METHOD_NAMES_BUFSIZE];
|
||||
ast_set_flag(&iaxs[fr->callno]->state, IAX_STATE_STARTED);
|
||||
ast_verb(3, "Accepting AUTHENTICATED call from %s:\n"
|
||||
"%srequested auth methods = (%s),\n"
|
||||
"%sactual auth method = %s,\n"
|
||||
"%sencrypted = %s,\n"
|
||||
"%srequested format = %s,\n"
|
||||
"%srequested prefs = %s,\n"
|
||||
"%sactual format = %s,\n"
|
||||
|
@ -11475,6 +11541,12 @@ static int socket_process_helper(struct iax2_thread *thread)
|
|||
"%spriority = %s\n",
|
||||
ast_sockaddr_stringify(&addr),
|
||||
VERBOSE_PREFIX_4,
|
||||
auth_method_names(iaxs[fr->callno]->authmethods, authmethodnames),
|
||||
VERBOSE_PREFIX_4,
|
||||
auth_method_labels[iaxs[fr->callno]->eff_auth_method],
|
||||
VERBOSE_PREFIX_4,
|
||||
IAX_CALLENCRYPTED(iaxs[fr->callno]) ? "yes" : "no",
|
||||
VERBOSE_PREFIX_4,
|
||||
iax2_getformatname(iaxs[fr->callno]->peerformat),
|
||||
VERBOSE_PREFIX_4,
|
||||
caller_pref_buf,
|
||||
|
@ -11543,7 +11615,7 @@ immediatedial:
|
|||
ast_string_field_set(iaxs[fr->callno], exten, ies.called_number ? ies.called_number : "s");
|
||||
if (!ast_exists_extension(NULL, iaxs[fr->callno]->context, iaxs[fr->callno]->exten, 1, iaxs[fr->callno]->cid_num)) {
|
||||
if (authdebug)
|
||||
ast_log(LOG_NOTICE, "Rejected dial attempt from %s, request '%s@%s' does not exist\n",
|
||||
ast_log(LOG_WARNING, "Rejected dial attempt from %s, request '%s@%s' does not exist\n",
|
||||
ast_sockaddr_stringify(&addr),
|
||||
iaxs[fr->callno]->exten,
|
||||
iaxs[fr->callno]->context);
|
||||
|
|
|
@ -3266,6 +3266,8 @@ static struct ast_custom_function session_refresh_function = {
|
|||
.write = pjsip_acf_session_refresh_write,
|
||||
};
|
||||
|
||||
static char *app_pjsip_hangup = "PJSIPHangup";
|
||||
|
||||
/*!
|
||||
* \brief Load the module
|
||||
*
|
||||
|
@ -3323,6 +3325,13 @@ static int load_module(void)
|
|||
goto end;
|
||||
}
|
||||
|
||||
if (ast_register_application_xml(app_pjsip_hangup, pjsip_app_hangup)) {
|
||||
ast_log(LOG_WARNING, "Unable to register PJSIPHangup dialplan application\n");
|
||||
goto end;
|
||||
}
|
||||
ast_manager_register_xml(app_pjsip_hangup, EVENT_FLAG_SYSTEM | EVENT_FLAG_CALL, pjsip_action_hangup);
|
||||
|
||||
|
||||
ast_sip_register_service(&refer_callback_module);
|
||||
|
||||
ast_sip_session_register_supplement(&chan_pjsip_supplement);
|
||||
|
@ -3370,6 +3379,9 @@ end:
|
|||
ast_custom_function_unregister(&chan_pjsip_dial_contacts_function);
|
||||
ast_custom_function_unregister(&chan_pjsip_parse_uri_function);
|
||||
ast_custom_function_unregister(&session_refresh_function);
|
||||
ast_unregister_application(app_pjsip_hangup);
|
||||
ast_manager_unregister(app_pjsip_hangup);
|
||||
|
||||
ast_channel_unregister(&chan_pjsip_tech);
|
||||
ast_rtp_glue_unregister(&chan_pjsip_rtp_glue);
|
||||
|
||||
|
@ -3399,6 +3411,8 @@ static int unload_module(void)
|
|||
ast_custom_function_unregister(&chan_pjsip_dial_contacts_function);
|
||||
ast_custom_function_unregister(&chan_pjsip_parse_uri_function);
|
||||
ast_custom_function_unregister(&session_refresh_function);
|
||||
ast_unregister_application(app_pjsip_hangup);
|
||||
ast_manager_unregister(app_pjsip_hangup);
|
||||
|
||||
ast_channel_unregister(&chan_pjsip_tech);
|
||||
ao2_ref(chan_pjsip_tech.capabilities, -1);
|
||||
|
|
|
@ -129,7 +129,8 @@ static struct ast_format *derive_format_from_cap(struct ast_format_cap *cap)
|
|||
* assignments. Signed linear @ 8kHz does not map, so if that is our
|
||||
* only capability, we force μ-law instead.
|
||||
*/
|
||||
fmt = ast_format_ulaw;
|
||||
ao2_ref(fmt, -1);
|
||||
fmt = ao2_bump(ast_format_ulaw);
|
||||
}
|
||||
|
||||
return fmt;
|
||||
|
@ -211,7 +212,7 @@ static struct ast_channel *multicast_rtp_request(const char *type, struct ast_fo
|
|||
}
|
||||
|
||||
chan = ast_channel_alloc(1, AST_STATE_DOWN, "", "", "", "", "", assignedids,
|
||||
requestor, 0, "MulticastRTP/%p", instance);
|
||||
requestor, 0, "MulticastRTP/%s-%p", args.destination, instance);
|
||||
if (!chan) {
|
||||
ast_rtp_instance_destroy(instance);
|
||||
goto failure;
|
||||
|
@ -249,6 +250,7 @@ failure:
|
|||
enum {
|
||||
OPT_RTP_CODEC = (1 << 0),
|
||||
OPT_RTP_ENGINE = (1 << 1),
|
||||
OPT_RTP_GLUE = (1 << 2),
|
||||
};
|
||||
|
||||
enum {
|
||||
|
@ -263,8 +265,14 @@ AST_APP_OPTIONS(unicast_rtp_options, BEGIN_OPTIONS
|
|||
AST_APP_OPTION_ARG('c', OPT_RTP_CODEC, OPT_ARG_RTP_CODEC),
|
||||
/*! Set the RTP engine to use for unicast RTP */
|
||||
AST_APP_OPTION_ARG('e', OPT_RTP_ENGINE, OPT_ARG_RTP_ENGINE),
|
||||
/*! Provide RTP glue for the channel */
|
||||
AST_APP_OPTION('g', OPT_RTP_GLUE),
|
||||
END_OPTIONS );
|
||||
|
||||
static const struct ast_datastore_info chan_rtp_datastore_info = {
|
||||
.type = "CHAN_RTP_GLUE",
|
||||
};
|
||||
|
||||
/*! \brief Function called when we should prepare to call the unicast destination */
|
||||
static struct ast_channel *unicast_rtp_request(const char *type, struct ast_format_cap *cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *data, int *cause)
|
||||
{
|
||||
|
@ -372,6 +380,13 @@ static struct ast_channel *unicast_rtp_request(const char *type, struct ast_form
|
|||
|
||||
ast_channel_tech_set(chan, &unicast_rtp_tech);
|
||||
|
||||
if (ast_test_flag(&opts, OPT_RTP_GLUE)) {
|
||||
struct ast_datastore *datastore;
|
||||
if ((datastore = ast_datastore_alloc(&chan_rtp_datastore_info, NULL))) {
|
||||
ast_channel_datastore_add(chan, datastore);
|
||||
}
|
||||
}
|
||||
|
||||
ast_format_cap_append(caps, fmt, 0);
|
||||
ast_channel_nativeformats_set(chan, caps);
|
||||
ast_channel_set_writeformat(chan, fmt);
|
||||
|
@ -401,6 +416,61 @@ failure:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/*! \brief Function called by RTP engine to get peer capabilities */
|
||||
static void chan_rtp_get_codec(struct ast_channel *chan, struct ast_format_cap *result)
|
||||
{
|
||||
SCOPE_ENTER(1, "%s Native formats %s\n", ast_channel_name(chan),
|
||||
ast_str_tmp(AST_FORMAT_CAP_NAMES_LEN, ast_format_cap_get_names(ast_channel_nativeformats(chan), &STR_TMP)));
|
||||
ast_format_cap_append_from_cap(result, ast_channel_nativeformats(chan), AST_MEDIA_TYPE_UNKNOWN);
|
||||
SCOPE_EXIT_RTN();
|
||||
}
|
||||
|
||||
/*! \brief Function called by RTP engine to change where the remote party should send media.
|
||||
*
|
||||
* chan_rtp is not able to actually update the peer, so this function has no effect.
|
||||
* */
|
||||
static int chan_rtp_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance *rtp, struct ast_rtp_instance *vrtp, struct ast_rtp_instance *tpeer, const struct ast_format_cap *cap, int nat_active)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*! \brief Function called by RTP engine to get local audio RTP peer */
|
||||
static enum ast_rtp_glue_result chan_rtp_get_vrtp_peer(struct ast_channel *chan, struct ast_rtp_instance **instance)
|
||||
{
|
||||
return AST_RTP_GLUE_RESULT_FORBID;
|
||||
}
|
||||
|
||||
/*! \brief Function called by RTP engine to get local audio RTP peer */
|
||||
static enum ast_rtp_glue_result chan_rtp_get_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance **instance)
|
||||
{
|
||||
struct ast_rtp_instance *rtp_instance = ast_channel_tech_pvt(chan);
|
||||
struct ast_datastore *datastore;
|
||||
|
||||
if (!rtp_instance) {
|
||||
return AST_RTP_GLUE_RESULT_FORBID;
|
||||
}
|
||||
|
||||
if ((datastore = ast_channel_datastore_find(chan, &chan_rtp_datastore_info, NULL))) {
|
||||
ao2_ref(datastore, -1);
|
||||
|
||||
*instance = rtp_instance;
|
||||
ao2_ref(*instance, +1);
|
||||
|
||||
return AST_RTP_GLUE_RESULT_LOCAL;
|
||||
}
|
||||
|
||||
return AST_RTP_GLUE_RESULT_FORBID;
|
||||
}
|
||||
|
||||
/*! \brief Local glue for interacting with the RTP engine core */
|
||||
static struct ast_rtp_glue unicast_rtp_glue = {
|
||||
.type = "UnicastRTP",
|
||||
.get_rtp_info = chan_rtp_get_rtp_peer,
|
||||
.get_vrtp_info = chan_rtp_get_vrtp_peer,
|
||||
.get_codec = chan_rtp_get_codec,
|
||||
.update_peer = chan_rtp_set_rtp_peer,
|
||||
};
|
||||
|
||||
/*! \brief Function called when our module is unloaded */
|
||||
static int unload_module(void)
|
||||
{
|
||||
|
@ -412,6 +482,8 @@ static int unload_module(void)
|
|||
ao2_cleanup(unicast_rtp_tech.capabilities);
|
||||
unicast_rtp_tech.capabilities = NULL;
|
||||
|
||||
ast_rtp_glue_unregister(&unicast_rtp_glue);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -421,6 +493,9 @@ static int load_module(void)
|
|||
if (!(multicast_rtp_tech.capabilities = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT))) {
|
||||
return AST_MODULE_LOAD_DECLINE;
|
||||
}
|
||||
|
||||
ast_rtp_glue_register(&unicast_rtp_glue);
|
||||
|
||||
ast_format_cap_append_by_type(multicast_rtp_tech.capabilities, AST_MEDIA_TYPE_UNKNOWN);
|
||||
if (ast_channel_register(&multicast_rtp_tech)) {
|
||||
ast_log(LOG_ERROR, "Unable to register channel class 'MulticastRTP'\n");
|
||||
|
|
|
@ -424,7 +424,7 @@ static void dump_ies(unsigned char *iedata, int len)
|
|||
|
||||
if (len < 2)
|
||||
return;
|
||||
while(len > 2) {
|
||||
while(len >= 2) {
|
||||
ie = iedata[0];
|
||||
ielen = iedata[1];
|
||||
if (ielen + 2> len) {
|
||||
|
@ -1063,7 +1063,7 @@ int iax_parse_ies(struct iax_ies *ies, unsigned char *data, int datalen)
|
|||
if (len == (int)sizeof(unsigned int)) {
|
||||
ies->calling_ani2 = ntohl(get_unaligned_uint32(data + 2));
|
||||
} else {
|
||||
snprintf(tmp, (int)sizeof(tmp), "callingani2 was %d long: %s\n", len, data + 2);
|
||||
snprintf(tmp, sizeof(tmp), "Expected callingani2 to be %zu bytes but was %d\n", sizeof(unsigned int), len);
|
||||
errorf(tmp);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -343,6 +343,7 @@ static int cli_channelstats_print_body(void *obj, void *arg, int flags)
|
|||
struct ast_sip_session *session;
|
||||
struct ast_sip_session_media *media;
|
||||
struct ast_rtp_instance_stats stats;
|
||||
struct ast_stream *stream;
|
||||
char *print_name = NULL;
|
||||
char *print_time = alloca(32);
|
||||
char codec_in_use[7];
|
||||
|
@ -359,16 +360,29 @@ static int cli_channelstats_print_body(void *obj, void *arg, int flags)
|
|||
|
||||
cpvt = ast_channel_tech_pvt(channel);
|
||||
session = cpvt ? cpvt->session : NULL;
|
||||
if (!session) {
|
||||
|
||||
if (!session
|
||||
|| !session->active_media_state
|
||||
|| !session->active_media_state->topology) {
|
||||
ast_str_append(&context->output_buffer, 0, " %s not valid\n", snapshot->base->name);
|
||||
ast_channel_unlock(channel);
|
||||
ao2_cleanup(channel);
|
||||
return 0;
|
||||
}
|
||||
|
||||
stream = ast_stream_topology_get_first_stream_by_type(
|
||||
session->active_media_state->topology, AST_MEDIA_TYPE_AUDIO);
|
||||
|
||||
if (!stream) {
|
||||
ast_str_append(&context->output_buffer, 0, " %s no audio streams\n", snapshot->base->name);
|
||||
ast_channel_unlock(channel);
|
||||
ao2_cleanup(channel);
|
||||
return 0;
|
||||
}
|
||||
|
||||
media = session->active_media_state->default_session[AST_MEDIA_TYPE_AUDIO];
|
||||
if (!media || !media->rtp) {
|
||||
ast_str_append(&context->output_buffer, 0, " %s not valid\n", snapshot->base->name);
|
||||
if (!media || media->type != AST_MEDIA_TYPE_AUDIO || !media->rtp) {
|
||||
ast_str_append(&context->output_buffer, 0, " %s corrupted default audio session\n", snapshot->base->name);
|
||||
ast_channel_unlock(channel);
|
||||
ao2_cleanup(channel);
|
||||
return 0;
|
||||
|
|
|
@ -29,563 +29,6 @@
|
|||
<support_level>core</support_level>
|
||||
***/
|
||||
|
||||
/*** DOCUMENTATION
|
||||
<function name="PJSIP_DIAL_CONTACTS" language="en_US">
|
||||
<synopsis>
|
||||
Return a dial string for dialing all contacts on an AOR.
|
||||
</synopsis>
|
||||
<syntax>
|
||||
<parameter name="endpoint" required="true">
|
||||
<para>Name of the endpoint</para>
|
||||
</parameter>
|
||||
<parameter name="aor" required="false">
|
||||
<para>Name of an AOR to use, if not specified the configured AORs on the endpoint are used</para>
|
||||
</parameter>
|
||||
<parameter name="request_user" required="false">
|
||||
<para>Optional request user to use in the request URI</para>
|
||||
</parameter>
|
||||
</syntax>
|
||||
<description>
|
||||
<para>Returns a properly formatted dial string for dialing all contacts on an AOR.</para>
|
||||
</description>
|
||||
</function>
|
||||
<function name="PJSIP_MEDIA_OFFER" language="en_US">
|
||||
<synopsis>
|
||||
Media and codec offerings to be set on an outbound SIP channel prior to dialing.
|
||||
</synopsis>
|
||||
<syntax>
|
||||
<parameter name="media" required="true">
|
||||
<para>types of media offered</para>
|
||||
</parameter>
|
||||
</syntax>
|
||||
<description>
|
||||
<para>When read, returns the codecs offered based upon the media choice.</para>
|
||||
<para>When written, sets the codecs to offer when an outbound dial attempt is made,
|
||||
or when a session refresh is sent using <replaceable>PJSIP_SEND_SESSION_REFRESH</replaceable>.
|
||||
</para>
|
||||
</description>
|
||||
<see-also>
|
||||
<ref type="function">PJSIP_SEND_SESSION_REFRESH</ref>
|
||||
</see-also>
|
||||
</function>
|
||||
<function name="PJSIP_DTMF_MODE" language="en_US">
|
||||
<since>
|
||||
<version>13.18.0</version>
|
||||
<version>14.7.0</version>
|
||||
<version>15.1.0</version>
|
||||
<version>16.0.0</version>
|
||||
</since>
|
||||
<synopsis>
|
||||
Get or change the DTMF mode for a SIP call.
|
||||
</synopsis>
|
||||
<syntax>
|
||||
</syntax>
|
||||
<description>
|
||||
<para>When read, returns the current DTMF mode</para>
|
||||
<para>When written, sets the current DTMF mode</para>
|
||||
<para>This function uses the same DTMF mode naming as the dtmf_mode configuration option</para>
|
||||
</description>
|
||||
</function>
|
||||
<function name="PJSIP_MOH_PASSTHROUGH" language="en_US">
|
||||
<synopsis>
|
||||
Get or change the on-hold behavior for a SIP call.
|
||||
</synopsis>
|
||||
<syntax>
|
||||
</syntax>
|
||||
<description>
|
||||
<para>When read, returns the current moh passthrough mode</para>
|
||||
<para>When written, sets the current moh passthrough mode</para>
|
||||
<para>If <replaceable>yes</replaceable>, on-hold re-INVITEs are sent. If <replaceable>no</replaceable>, music on hold is generated.</para>
|
||||
<para>This function can be used to override the moh_passthrough configuration option</para>
|
||||
</description>
|
||||
</function>
|
||||
<function name="PJSIP_SEND_SESSION_REFRESH" language="en_US">
|
||||
<since>
|
||||
<version>13.12.0</version>
|
||||
<version>14.1.0</version>
|
||||
<version>15.0.0</version>
|
||||
</since>
|
||||
<synopsis>
|
||||
W/O: Initiate a session refresh via an UPDATE or re-INVITE on an established media session
|
||||
</synopsis>
|
||||
<syntax>
|
||||
<parameter name="update_type" required="false">
|
||||
<para>The type of update to send. Default is <literal>invite</literal>.</para>
|
||||
<enumlist>
|
||||
<enum name="invite">
|
||||
<para>Send the session refresh as a re-INVITE.</para>
|
||||
</enum>
|
||||
<enum name="update">
|
||||
<para>Send the session refresh as an UPDATE.</para>
|
||||
</enum>
|
||||
</enumlist>
|
||||
</parameter>
|
||||
</syntax>
|
||||
<description>
|
||||
<para>This function will cause the PJSIP stack to immediately refresh
|
||||
the media session for the channel. This will be done using either a
|
||||
re-INVITE (default) or an UPDATE request.
|
||||
</para>
|
||||
<para>This is most useful when combined with the <replaceable>PJSIP_MEDIA_OFFER</replaceable>
|
||||
dialplan function, as it allows the formats in use on a channel to be
|
||||
re-negotiated after call setup.</para>
|
||||
<warning>
|
||||
<para>The formats the endpoint supports are <emphasis>not</emphasis>
|
||||
checked or enforced by this function. Using this function to offer
|
||||
formats not supported by the endpoint <emphasis>may</emphasis> result
|
||||
in a loss of media.</para>
|
||||
</warning>
|
||||
<example title="Re-negotiate format to g722">
|
||||
; Within some existing extension on an answered channel
|
||||
same => n,Set(PJSIP_MEDIA_OFFER(audio)=!all,g722)
|
||||
same => n,Set(PJSIP_SEND_SESSION_REFRESH()=invite)
|
||||
</example>
|
||||
</description>
|
||||
<see-also>
|
||||
<ref type="function">PJSIP_MEDIA_OFFER</ref>
|
||||
</see-also>
|
||||
</function>
|
||||
<function name="PJSIP_PARSE_URI" language="en_US">
|
||||
<since>
|
||||
<version>13.24.0</version>
|
||||
<version>16.1.0</version>
|
||||
<version>17.0.0</version>
|
||||
</since>
|
||||
<synopsis>
|
||||
Parse an uri and return a type part of the URI.
|
||||
</synopsis>
|
||||
<syntax>
|
||||
<parameter name="uri" required="true">
|
||||
<para>URI to parse</para>
|
||||
</parameter>
|
||||
<parameter name="type" required="true">
|
||||
<para>The <literal>type</literal> parameter specifies which URI part to read</para>
|
||||
<enumlist>
|
||||
<enum name="display">
|
||||
<para>Display name.</para>
|
||||
</enum>
|
||||
<enum name="scheme">
|
||||
<para>URI scheme.</para>
|
||||
</enum>
|
||||
<enum name="user">
|
||||
<para>User part.</para>
|
||||
</enum>
|
||||
<enum name="passwd">
|
||||
<para>Password part.</para>
|
||||
</enum>
|
||||
<enum name="host">
|
||||
<para>Host part.</para>
|
||||
</enum>
|
||||
<enum name="port">
|
||||
<para>Port number, or zero.</para>
|
||||
</enum>
|
||||
<enum name="user_param">
|
||||
<para>User parameter.</para>
|
||||
</enum>
|
||||
<enum name="method_param">
|
||||
<para>Method parameter.</para>
|
||||
</enum>
|
||||
<enum name="transport_param">
|
||||
<para>Transport parameter.</para>
|
||||
</enum>
|
||||
<enum name="ttl_param">
|
||||
<para>TTL param, or -1.</para>
|
||||
</enum>
|
||||
<enum name="lr_param">
|
||||
<para>Loose routing param, or zero.</para>
|
||||
</enum>
|
||||
<enum name="maddr_param">
|
||||
<para>Maddr param.</para>
|
||||
</enum>
|
||||
</enumlist>
|
||||
</parameter>
|
||||
</syntax>
|
||||
<description>
|
||||
<para>Parse an URI and return a specified part of the URI.</para>
|
||||
</description>
|
||||
</function>
|
||||
<info name="CHANNEL" language="en_US" tech="PJSIP">
|
||||
<enumlist>
|
||||
<enum name="rtp">
|
||||
<para>R/O Retrieve media related information.</para>
|
||||
<parameter name="type" required="true">
|
||||
<para>When <replaceable>rtp</replaceable> is specified, the
|
||||
<literal>type</literal> parameter must be provided. It specifies
|
||||
which RTP parameter to read.</para>
|
||||
<enumlist>
|
||||
<enum name="src">
|
||||
<para>Retrieve the local address for RTP.</para>
|
||||
</enum>
|
||||
<enum name="dest">
|
||||
<para>Retrieve the remote address for RTP.</para>
|
||||
</enum>
|
||||
<enum name="direct">
|
||||
<para>If direct media is enabled, this address is the remote address
|
||||
used for RTP.</para>
|
||||
</enum>
|
||||
<enum name="secure">
|
||||
<para>Whether or not the media stream is encrypted.</para>
|
||||
<enumlist>
|
||||
<enum name="0">
|
||||
<para>The media stream is not encrypted.</para>
|
||||
</enum>
|
||||
<enum name="1">
|
||||
<para>The media stream is encrypted.</para>
|
||||
</enum>
|
||||
</enumlist>
|
||||
</enum>
|
||||
<enum name="hold">
|
||||
<para>Whether or not the media stream is currently restricted
|
||||
due to a call hold.</para>
|
||||
<enumlist>
|
||||
<enum name="0">
|
||||
<para>The media stream is not held.</para>
|
||||
</enum>
|
||||
<enum name="1">
|
||||
<para>The media stream is held.</para>
|
||||
</enum>
|
||||
</enumlist>
|
||||
</enum>
|
||||
</enumlist>
|
||||
</parameter>
|
||||
<parameter name="media_type" required="false">
|
||||
<para>When <replaceable>rtp</replaceable> is specified, the
|
||||
<literal>media_type</literal> parameter may be provided. It specifies
|
||||
which media stream the chosen RTP parameter should be retrieved
|
||||
from.</para>
|
||||
<enumlist>
|
||||
<enum name="audio">
|
||||
<para>Retrieve information from the audio media stream.</para>
|
||||
<note><para>If not specified, <literal>audio</literal> is used
|
||||
by default.</para></note>
|
||||
</enum>
|
||||
<enum name="video">
|
||||
<para>Retrieve information from the video media stream.</para>
|
||||
</enum>
|
||||
</enumlist>
|
||||
</parameter>
|
||||
</enum>
|
||||
<enum name="rtcp">
|
||||
<para>R/O Retrieve RTCP statistics.</para>
|
||||
<parameter name="statistic" required="true">
|
||||
<para>When <replaceable>rtcp</replaceable> is specified, the
|
||||
<literal>statistic</literal> parameter must be provided. It specifies
|
||||
which RTCP statistic parameter to read.</para>
|
||||
<enumlist>
|
||||
<enum name="all">
|
||||
<para>Retrieve a summary of all RTCP statistics.</para>
|
||||
<para>The following data items are returned in a semi-colon
|
||||
delineated list:</para>
|
||||
<enumlist>
|
||||
<enum name="ssrc">
|
||||
<para>Our Synchronization Source identifier</para>
|
||||
</enum>
|
||||
<enum name="themssrc">
|
||||
<para>Their Synchronization Source identifier</para>
|
||||
</enum>
|
||||
<enum name="lp">
|
||||
<para>Our lost packet count</para>
|
||||
</enum>
|
||||
<enum name="rxjitter">
|
||||
<para>Received packet jitter</para>
|
||||
</enum>
|
||||
<enum name="rxcount">
|
||||
<para>Received packet count</para>
|
||||
</enum>
|
||||
<enum name="txjitter">
|
||||
<para>Transmitted packet jitter</para>
|
||||
</enum>
|
||||
<enum name="txcount">
|
||||
<para>Transmitted packet count</para>
|
||||
</enum>
|
||||
<enum name="rlp">
|
||||
<para>Remote lost packet count</para>
|
||||
</enum>
|
||||
<enum name="rtt">
|
||||
<para>Round trip time</para>
|
||||
</enum>
|
||||
<enum name="txmes">
|
||||
<para>Transmitted Media Experience Score</para>
|
||||
</enum>
|
||||
<enum name="rxmes">
|
||||
<para>Received Media Experience Score</para>
|
||||
</enum>
|
||||
</enumlist>
|
||||
</enum>
|
||||
<enum name="all_jitter">
|
||||
<para>Retrieve a summary of all RTCP Jitter statistics.</para>
|
||||
<para>The following data items are returned in a semi-colon
|
||||
delineated list:</para>
|
||||
<enumlist>
|
||||
<enum name="minrxjitter">
|
||||
<para>Our minimum jitter</para>
|
||||
</enum>
|
||||
<enum name="maxrxjitter">
|
||||
<para>Our max jitter</para>
|
||||
</enum>
|
||||
<enum name="avgrxjitter">
|
||||
<para>Our average jitter</para>
|
||||
</enum>
|
||||
<enum name="stdevrxjitter">
|
||||
<para>Our jitter standard deviation</para>
|
||||
</enum>
|
||||
<enum name="reported_minjitter">
|
||||
<para>Their minimum jitter</para>
|
||||
</enum>
|
||||
<enum name="reported_maxjitter">
|
||||
<para>Their max jitter</para>
|
||||
</enum>
|
||||
<enum name="reported_avgjitter">
|
||||
<para>Their average jitter</para>
|
||||
</enum>
|
||||
<enum name="reported_stdevjitter">
|
||||
<para>Their jitter standard deviation</para>
|
||||
</enum>
|
||||
</enumlist>
|
||||
</enum>
|
||||
<enum name="all_loss">
|
||||
<para>Retrieve a summary of all RTCP packet loss statistics.</para>
|
||||
<para>The following data items are returned in a semi-colon
|
||||
delineated list:</para>
|
||||
<enumlist>
|
||||
<enum name="minrxlost">
|
||||
<para>Our minimum lost packets</para>
|
||||
</enum>
|
||||
<enum name="maxrxlost">
|
||||
<para>Our max lost packets</para>
|
||||
</enum>
|
||||
<enum name="avgrxlost">
|
||||
<para>Our average lost packets</para>
|
||||
</enum>
|
||||
<enum name="stdevrxlost">
|
||||
<para>Our lost packets standard deviation</para>
|
||||
</enum>
|
||||
<enum name="reported_minlost">
|
||||
<para>Their minimum lost packets</para>
|
||||
</enum>
|
||||
<enum name="reported_maxlost">
|
||||
<para>Their max lost packets</para>
|
||||
</enum>
|
||||
<enum name="reported_avglost">
|
||||
<para>Their average lost packets</para>
|
||||
</enum>
|
||||
<enum name="reported_stdevlost">
|
||||
<para>Their lost packets standard deviation</para>
|
||||
</enum>
|
||||
</enumlist>
|
||||
</enum>
|
||||
<enum name="all_rtt">
|
||||
<para>Retrieve a summary of all RTCP round trip time information.</para>
|
||||
<para>The following data items are returned in a semi-colon
|
||||
delineated list:</para>
|
||||
<enumlist>
|
||||
<enum name="minrtt">
|
||||
<para>Minimum round trip time</para>
|
||||
</enum>
|
||||
<enum name="maxrtt">
|
||||
<para>Maximum round trip time</para>
|
||||
</enum>
|
||||
<enum name="avgrtt">
|
||||
<para>Average round trip time</para>
|
||||
</enum>
|
||||
<enum name="stdevrtt">
|
||||
<para>Standard deviation round trip time</para>
|
||||
</enum>
|
||||
</enumlist>
|
||||
</enum>
|
||||
<enum name="all_mes">
|
||||
<para>Retrieve a summary of all RTCP Media Experience Score information.</para>
|
||||
<para>The following data items are returned in a semi-colon
|
||||
delineated list:</para>
|
||||
<enumlist>
|
||||
<enum name="minmes">
|
||||
<para>Minimum MES based on us analysing received packets.</para>
|
||||
</enum>
|
||||
<enum name="maxmes">
|
||||
<para>Maximum MES based on us analysing received packets.</para>
|
||||
</enum>
|
||||
<enum name="avgmes">
|
||||
<para>Average MES based on us analysing received packets.</para>
|
||||
</enum>
|
||||
<enum name="stdevmes">
|
||||
<para>Standard deviation MES based on us analysing received packets.</para>
|
||||
</enum>
|
||||
<enum name="reported_minmes">
|
||||
<para>Minimum MES based on data we get in Sender and Receiver Reports sent by the remote end</para>
|
||||
</enum>
|
||||
<enum name="reported_maxmes">
|
||||
<para>Maximum MES based on data we get in Sender and Receiver Reports sent by the remote end</para>
|
||||
</enum>
|
||||
<enum name="reported_avgmes">
|
||||
<para>Average MES based on data we get in Sender and Receiver Reports sent by the remote end</para>
|
||||
</enum>
|
||||
<enum name="reported_stdevmes">
|
||||
<para>Standard deviation MES based on data we get in Sender and Receiver Reports sent by the remote end</para>
|
||||
</enum>
|
||||
</enumlist>
|
||||
</enum>
|
||||
<enum name="txcount"><para>Transmitted packet count</para></enum>
|
||||
<enum name="rxcount"><para>Received packet count</para></enum>
|
||||
<enum name="txjitter"><para>Transmitted packet jitter</para></enum>
|
||||
<enum name="rxjitter"><para>Received packet jitter</para></enum>
|
||||
<enum name="remote_maxjitter"><para>Their max jitter</para></enum>
|
||||
<enum name="remote_minjitter"><para>Their minimum jitter</para></enum>
|
||||
<enum name="remote_normdevjitter"><para>Their average jitter</para></enum>
|
||||
<enum name="remote_stdevjitter"><para>Their jitter standard deviation</para></enum>
|
||||
<enum name="local_maxjitter"><para>Our max jitter</para></enum>
|
||||
<enum name="local_minjitter"><para>Our minimum jitter</para></enum>
|
||||
<enum name="local_normdevjitter"><para>Our average jitter</para></enum>
|
||||
<enum name="local_stdevjitter"><para>Our jitter standard deviation</para></enum>
|
||||
<enum name="txploss"><para>Transmitted packet loss</para></enum>
|
||||
<enum name="rxploss"><para>Received packet loss</para></enum>
|
||||
<enum name="remote_maxrxploss"><para>Their max lost packets</para></enum>
|
||||
<enum name="remote_minrxploss"><para>Their minimum lost packets</para></enum>
|
||||
<enum name="remote_normdevrxploss"><para>Their average lost packets</para></enum>
|
||||
<enum name="remote_stdevrxploss"><para>Their lost packets standard deviation</para></enum>
|
||||
<enum name="local_maxrxploss"><para>Our max lost packets</para></enum>
|
||||
<enum name="local_minrxploss"><para>Our minimum lost packets</para></enum>
|
||||
<enum name="local_normdevrxploss"><para>Our average lost packets</para></enum>
|
||||
<enum name="local_stdevrxploss"><para>Our lost packets standard deviation</para></enum>
|
||||
<enum name="rtt"><para>Round trip time</para></enum>
|
||||
<enum name="maxrtt"><para>Maximum round trip time</para></enum>
|
||||
<enum name="minrtt"><para>Minimum round trip time</para></enum>
|
||||
<enum name="normdevrtt"><para>Average round trip time</para></enum>
|
||||
<enum name="stdevrtt"><para>Standard deviation round trip time</para></enum>
|
||||
<enum name="local_ssrc"><para>Our Synchronization Source identifier</para></enum>
|
||||
<enum name="remote_ssrc"><para>Their Synchronization Source identifier</para></enum>
|
||||
<enum name="txmes"><para>
|
||||
Current MES based on us analyzing rtt, jitter and loss
|
||||
in the actual received RTP stream received from the remote end.
|
||||
I.E. This is the MES for the incoming audio stream.
|
||||
</para></enum>
|
||||
<enum name="rxmes"><para>
|
||||
Current MES based on rtt and the jitter and loss values in
|
||||
RTCP sender and receiver reports we receive from the
|
||||
remote end. I.E. This is the MES for the outgoing audio stream.
|
||||
</para></enum>
|
||||
<enum name="remote_maxmes"><para>Max MES based on data we get in Sender and Receiver Reports sent by the remote end</para></enum>
|
||||
<enum name="remote_minmes"><para>Min MES based on data we get in Sender and Receiver Reports sent by the remote end</para></enum>
|
||||
<enum name="remote_normdevmes"><para>Average MES based on data we get in Sender and Receiver Reports sent by the remote end</para></enum>
|
||||
<enum name="remote_stdevmes"><para>Standard deviation MES based on data we get in Sender and Receiver Reports sent by the remote end</para></enum>
|
||||
<enum name="local_maxmes"><para>Max MES based on us analyzing the received RTP stream</para></enum>
|
||||
<enum name="local_minmes"><para>Min MES based on us analyzing the received RTP stream</para></enum>
|
||||
<enum name="local_normdevmes"><para>Average MES based on us analyzing the received RTP stream</para></enum>
|
||||
<enum name="local_stdevmes"><para>Standard deviation MES based on us analyzing the received RTP stream</para></enum>
|
||||
</enumlist>
|
||||
</parameter>
|
||||
<parameter name="media_type" required="false">
|
||||
<para>When <replaceable>rtcp</replaceable> is specified, the
|
||||
<literal>media_type</literal> parameter may be provided. It specifies
|
||||
which media stream the chosen RTCP parameter should be retrieved
|
||||
from.</para>
|
||||
<enumlist>
|
||||
<enum name="audio">
|
||||
<para>Retrieve information from the audio media stream.</para>
|
||||
<note><para>If not specified, <literal>audio</literal> is used
|
||||
by default.</para></note>
|
||||
</enum>
|
||||
<enum name="video">
|
||||
<para>Retrieve information from the video media stream.</para>
|
||||
</enum>
|
||||
</enumlist>
|
||||
</parameter>
|
||||
</enum>
|
||||
<enum name="endpoint">
|
||||
<para>R/O The name of the endpoint associated with this channel.
|
||||
Use the <replaceable>PJSIP_ENDPOINT</replaceable> function to obtain
|
||||
further endpoint related information.</para>
|
||||
</enum>
|
||||
<enum name="contact">
|
||||
<para>R/O The name of the contact associated with this channel.
|
||||
Use the <replaceable>PJSIP_CONTACT</replaceable> function to obtain
|
||||
further contact related information. Note this may not be present and if so
|
||||
is only available on outgoing legs.</para>
|
||||
</enum>
|
||||
<enum name="aor">
|
||||
<para>R/O The name of the AOR associated with this channel.
|
||||
Use the <replaceable>PJSIP_AOR</replaceable> function to obtain
|
||||
further AOR related information. Note this may not be present and if so
|
||||
is only available on outgoing legs.</para>
|
||||
</enum>
|
||||
<enum name="pjsip">
|
||||
<para>R/O Obtain information about the current PJSIP channel and its
|
||||
session.</para>
|
||||
<parameter name="type" required="true">
|
||||
<para>When <replaceable>pjsip</replaceable> is specified, the
|
||||
<literal>type</literal> parameter must be provided. It specifies
|
||||
which signalling parameter to read.</para>
|
||||
<enumlist>
|
||||
<enum name="call-id">
|
||||
<para>The SIP call-id.</para>
|
||||
</enum>
|
||||
<enum name="secure">
|
||||
<para>Whether or not the signalling uses a secure transport.</para>
|
||||
<enumlist>
|
||||
<enum name="0"><para>The signalling uses a non-secure transport.</para></enum>
|
||||
<enum name="1"><para>The signalling uses a secure transport.</para></enum>
|
||||
</enumlist>
|
||||
</enum>
|
||||
<enum name="target_uri">
|
||||
<para>The contact URI where requests are sent.</para>
|
||||
</enum>
|
||||
<enum name="local_uri">
|
||||
<para>The local URI.</para>
|
||||
</enum>
|
||||
<enum name="local_tag">
|
||||
<para>Tag in From header</para>
|
||||
</enum>
|
||||
<enum name="remote_uri">
|
||||
<para>The remote URI.</para>
|
||||
</enum>
|
||||
<enum name="remote_tag">
|
||||
<para>Tag in To header</para>
|
||||
</enum>
|
||||
<enum name="request_uri">
|
||||
<para>The request URI of the incoming <literal>INVITE</literal>
|
||||
associated with the creation of this channel.</para>
|
||||
</enum>
|
||||
<enum name="t38state">
|
||||
<para>The current state of any T.38 fax on this channel.</para>
|
||||
<enumlist>
|
||||
<enum name="DISABLED"><para>T.38 faxing is disabled on this channel.</para></enum>
|
||||
<enum name="LOCAL_REINVITE"><para>Asterisk has sent a <literal>re-INVITE</literal> to the remote end to initiate a T.38 fax.</para></enum>
|
||||
<enum name="REMOTE_REINVITE"><para>The remote end has sent a <literal>re-INVITE</literal> to Asterisk to initiate a T.38 fax.</para></enum>
|
||||
<enum name="ENABLED"><para>A T.38 fax session has been enabled.</para></enum>
|
||||
<enum name="REJECTED"><para>A T.38 fax session was attempted but was rejected.</para></enum>
|
||||
</enumlist>
|
||||
</enum>
|
||||
<enum name="local_addr">
|
||||
<para>On inbound calls, the full IP address and port number that
|
||||
the <literal>INVITE</literal> request was received on. On outbound
|
||||
calls, the full IP address and port number that the <literal>INVITE</literal>
|
||||
request was transmitted from.</para>
|
||||
</enum>
|
||||
<enum name="remote_addr">
|
||||
<para>On inbound calls, the full IP address and port number that
|
||||
the <literal>INVITE</literal> request was received from. On outbound
|
||||
calls, the full IP address and port number that the <literal>INVITE</literal>
|
||||
request was transmitted to.</para>
|
||||
</enum>
|
||||
</enumlist>
|
||||
</parameter>
|
||||
</enum>
|
||||
</enumlist>
|
||||
</info>
|
||||
<info name="CHANNEL_EXAMPLES" language="en_US" tech="PJSIP">
|
||||
<example title="PJSIP specific CHANNEL examples">
|
||||
; Log the current Call-ID
|
||||
same => n,Log(NOTICE, ${CHANNEL(pjsip,call-id)})
|
||||
|
||||
; Log the destination address of the audio stream
|
||||
same => n,Log(NOTICE, ${CHANNEL(rtp,dest)})
|
||||
|
||||
; Store the round-trip time associated with a
|
||||
; video stream in the CDR field video-rtt
|
||||
same => n,Set(CDR(video-rtt)=${CHANNEL(rtcp,rtt,video)})
|
||||
</example>
|
||||
</info>
|
||||
***/
|
||||
|
||||
#include "asterisk.h"
|
||||
|
||||
#include <pjsip.h>
|
||||
|
@ -596,6 +39,7 @@
|
|||
#include "asterisk/module.h"
|
||||
#include "asterisk/acl.h"
|
||||
#include "asterisk/app.h"
|
||||
#include "asterisk/conversions.h"
|
||||
#include "asterisk/channel.h"
|
||||
#include "asterisk/stream.h"
|
||||
#include "asterisk/format.h"
|
||||
|
@ -1784,3 +1228,121 @@ int pjsip_acf_session_refresh_write(struct ast_channel *chan, const char *cmd, c
|
|||
|
||||
return ast_sip_push_task_wait_serializer(channel->session->serializer, refresh_write_cb, &rdata);
|
||||
}
|
||||
|
||||
struct hangup_data {
|
||||
struct ast_sip_session *session;
|
||||
int response_code;
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief Serializer task to hangup channel
|
||||
*/
|
||||
static int pjsip_hangup(void *obj)
|
||||
{
|
||||
struct hangup_data *hdata = obj;
|
||||
pjsip_tx_data *packet = NULL;
|
||||
|
||||
if ((hdata->session->inv_session->state != PJSIP_INV_STATE_DISCONNECTED) &&
|
||||
(pjsip_inv_answer(hdata->session->inv_session, hdata->response_code, NULL, NULL, &packet) == PJ_SUCCESS)) {
|
||||
ast_sip_session_send_response(hdata->session, packet);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Callback that validates the response code
|
||||
*/
|
||||
static int response_code_validator(const char *channel_name,
|
||||
const char *response) {
|
||||
int response_code;
|
||||
|
||||
int rc = ast_str_to_int(response, &response_code);
|
||||
if (rc != 0) {
|
||||
response_code = ast_sip_str2rc(response);
|
||||
if (response_code < 0) {
|
||||
ast_log(LOG_WARNING, "%s: Unrecognized response code parameter '%s'."
|
||||
" Defaulting to 603 DECLINE\n",
|
||||
channel_name, response);
|
||||
return PJSIP_SC_DECLINE;
|
||||
}
|
||||
}
|
||||
|
||||
if (response_code < 400 || response_code > 699) {
|
||||
ast_log(LOG_WARNING, "%s: Response code %d is out of range 400 -> 699."
|
||||
" Defaulting to 603 DECLINE\n",
|
||||
channel_name, response_code);
|
||||
return PJSIP_SC_DECLINE;
|
||||
}
|
||||
return response_code;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Called by pjsip_app_hangup and pjsip_action_hangup
|
||||
* to actually perform the hangup
|
||||
*/
|
||||
static void pjsip_app_hangup_handler(struct ast_channel *chan, int response_code)
|
||||
{
|
||||
struct ast_sip_channel_pvt *channel;
|
||||
struct hangup_data hdata = { NULL, -1 };
|
||||
const char *tag = ast_channel_name(chan);
|
||||
|
||||
hdata.response_code = response_code;
|
||||
|
||||
ast_channel_lock(chan);
|
||||
if (strcmp(ast_channel_tech(chan)->type, "PJSIP")) {
|
||||
ast_log(LOG_WARNING, "%s: Not a PJSIP channel\n", tag);
|
||||
ast_channel_unlock(chan);
|
||||
return;
|
||||
}
|
||||
|
||||
channel = ast_channel_tech_pvt(chan);
|
||||
hdata.session = channel->session;
|
||||
|
||||
if (hdata.session->inv_session->role != PJSIP_ROLE_UAS || (
|
||||
hdata.session->inv_session->state != PJSIP_INV_STATE_INCOMING &&
|
||||
hdata.session->inv_session->state != PJSIP_INV_STATE_EARLY)) {
|
||||
ast_log(LOG_WARNING, "%s: Not an incoming channel or invalid state '%s'\n",
|
||||
tag, pjsip_inv_state_name(hdata.session->inv_session->state));
|
||||
ast_channel_unlock(chan);
|
||||
return;
|
||||
}
|
||||
|
||||
ast_channel_unlock(chan);
|
||||
|
||||
if (ast_sip_push_task_wait_serializer(channel->session->serializer,
|
||||
pjsip_hangup, &hdata) != 0) {
|
||||
ast_log(LOG_WARNING, "%s: failed to push hangup task to serializer\n", tag);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief PJSIPHangup Dialplan App
|
||||
*/
|
||||
int pjsip_app_hangup(struct ast_channel *chan, const char *data)
|
||||
{
|
||||
int response_code;
|
||||
const char *tag = ast_channel_name(chan);
|
||||
|
||||
if (ast_strlen_zero(data)) {
|
||||
ast_log(LOG_WARNING, "%s: Missing response code parameter\n", tag);
|
||||
return -1;
|
||||
}
|
||||
|
||||
response_code = response_code_validator(tag, data);
|
||||
|
||||
pjsip_app_hangup_handler(chan, response_code);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief PJSIPHangup Manager Action
|
||||
*/
|
||||
int pjsip_action_hangup(struct mansession *s, const struct message *m)
|
||||
{
|
||||
return ast_manager_hangup_helper(s, m,
|
||||
pjsip_app_hangup_handler, response_code_validator);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,659 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE docs SYSTEM "appdocsxml.dtd">
|
||||
<docs>
|
||||
<application name="PJSIPHangup" language="en_US">
|
||||
<synopsis>
|
||||
Hangup an incoming PJSIP channel with a SIP response code
|
||||
</synopsis>
|
||||
<syntax>
|
||||
<parameter name="Cause" required="true">
|
||||
<para>May be one of...</para>
|
||||
<enumlist>
|
||||
<enum name="Response code"><para>A numeric response code in the range 400 ->699</para></enum>
|
||||
<enum name="Response code name"><para>A response code name from
|
||||
<literal>third-party/pjproject/source/pjsip/include/pjsip/sip_msg.h</literal>
|
||||
such as <literal>USE_IDENTITY_HEADER</literal> or
|
||||
<literal>PJSIP_SC_USE_IDENTITY_HEADER</literal></para></enum>
|
||||
</enumlist>
|
||||
</parameter>
|
||||
</syntax>
|
||||
<description>
|
||||
<para>
|
||||
Hangs up an incoming PJSIP channel and returns the
|
||||
specified SIP response code in the final response to the caller.
|
||||
</para>
|
||||
<para>
|
||||
</para>
|
||||
<warning><para>
|
||||
This function must be called BEFORE anything that
|
||||
might cause any other final (non 1XX) response to be sent.
|
||||
For example calling <literal>Answer()</literal> or
|
||||
<literal>Playback</literal> without the
|
||||
<literal>noanswer</literal> option will cause the call
|
||||
to be answered and a final 200 response to be sent.
|
||||
</para></warning>
|
||||
<para>
|
||||
</para>
|
||||
<para>As with the <literal>Hangup</literal> application,
|
||||
the dialplan will terminate after calling this function.</para>
|
||||
<para>
|
||||
</para>
|
||||
<para>The cause code set on the channel will be translated to
|
||||
a standard ISDN cause code using the table defined in
|
||||
ast_sip_hangup_sip2cause() in res_pjsip.c</para>
|
||||
<para>
|
||||
</para>
|
||||
<example title="Terminate call with 437 response code">
|
||||
same = n,PJSIPHangup(437)
|
||||
</example>
|
||||
<example title="Terminate call with 437 response code using the response code name">
|
||||
same = n,PJSIPHangup(UNSUPPORTED_CERTIFICATE)
|
||||
</example>
|
||||
<example title="Terminate call with 437 response code based on condition">
|
||||
same = n,ExecIf($[${SOMEVALUE} = ${SOME_BAD_VALUE}]?PJSIPHangup(437))
|
||||
</example>
|
||||
</description>
|
||||
</application>
|
||||
|
||||
<manager name="PJSIPHangup" language="en_US">
|
||||
<synopsis>
|
||||
Hangup an incoming PJSIP channel with a SIP response code
|
||||
</synopsis>
|
||||
<syntax>
|
||||
<xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
|
||||
<xi:include xpointer="xpointer(/docs/manager[@name='Hangup']/syntax/parameter[@name='Channel'])" />
|
||||
<xi:include xpointer="xpointer(/docs/application[@name='PJSIPHangup']/syntax/parameter[@name='Cause'])" />
|
||||
</syntax>
|
||||
<description>
|
||||
<para>
|
||||
Hangs up an incoming PJSIP channel and returns the
|
||||
specified SIP response code in the final response to the caller.
|
||||
</para>
|
||||
<para>
|
||||
</para>
|
||||
<warning><para>
|
||||
This function must be called BEFORE anything that
|
||||
might cause any other final (non 1XX) response to be sent.
|
||||
For example calling <literal>Answer()</literal> or
|
||||
<literal>Playback</literal> without the
|
||||
<literal>noanswer</literal> option will cause the call
|
||||
to be answered and a final 200 response to be sent.
|
||||
</para></warning>
|
||||
<para>
|
||||
</para>
|
||||
<para>The cause code set on the channel will be translated to
|
||||
a standard ISDN cause code using the table defined in
|
||||
ast_sip_hangup_sip2cause() in res_pjsip.c</para>
|
||||
<para>
|
||||
</para>
|
||||
<example title="Terminate call with 437 response code">
|
||||
Action: PJSIPHangup
|
||||
ActionID: 12345678
|
||||
Channel: PJSIP/alice-00000002
|
||||
Cause: 437
|
||||
</example>
|
||||
<example title="Terminate call with 437 response code using the response code name">
|
||||
Action: PJSIPHangup
|
||||
ActionID: 12345678
|
||||
Channel: PJSIP/alice-00000002
|
||||
Cause: UNSUPPORTED_CERTIFICATE
|
||||
</example>
|
||||
</description>
|
||||
</manager>
|
||||
|
||||
<function name="PJSIP_DIAL_CONTACTS" language="en_US">
|
||||
<synopsis>
|
||||
Return a dial string for dialing all contacts on an AOR.
|
||||
</synopsis>
|
||||
<syntax>
|
||||
<parameter name="endpoint" required="true">
|
||||
<para>Name of the endpoint</para>
|
||||
</parameter>
|
||||
<parameter name="aor" required="false">
|
||||
<para>Name of an AOR to use, if not specified the configured AORs on the endpoint are used</para>
|
||||
</parameter>
|
||||
<parameter name="request_user" required="false">
|
||||
<para>Optional request user to use in the request URI</para>
|
||||
</parameter>
|
||||
</syntax>
|
||||
<description>
|
||||
<para>Returns a properly formatted dial string for dialing all contacts on an AOR.</para>
|
||||
</description>
|
||||
</function>
|
||||
<function name="PJSIP_MEDIA_OFFER" language="en_US">
|
||||
<synopsis>
|
||||
Media and codec offerings to be set on an outbound SIP channel prior to dialing.
|
||||
</synopsis>
|
||||
<syntax>
|
||||
<parameter name="media" required="true">
|
||||
<para>types of media offered</para>
|
||||
</parameter>
|
||||
</syntax>
|
||||
<description>
|
||||
<para>When read, returns the codecs offered based upon the media choice.</para>
|
||||
<para>When written, sets the codecs to offer when an outbound dial attempt is made,
|
||||
or when a session refresh is sent using <replaceable>PJSIP_SEND_SESSION_REFRESH</replaceable>.
|
||||
</para>
|
||||
</description>
|
||||
<see-also>
|
||||
<ref type="function">PJSIP_SEND_SESSION_REFRESH</ref>
|
||||
</see-also>
|
||||
</function>
|
||||
<function name="PJSIP_DTMF_MODE" language="en_US">
|
||||
<since>
|
||||
<version>13.18.0</version>
|
||||
<version>14.7.0</version>
|
||||
<version>15.1.0</version>
|
||||
<version>16.0.0</version>
|
||||
</since>
|
||||
<synopsis>
|
||||
Get or change the DTMF mode for a SIP call.
|
||||
</synopsis>
|
||||
<syntax>
|
||||
</syntax>
|
||||
<description>
|
||||
<para>When read, returns the current DTMF mode</para>
|
||||
<para>When written, sets the current DTMF mode</para>
|
||||
<para>This function uses the same DTMF mode naming as the dtmf_mode configuration option</para>
|
||||
</description>
|
||||
</function>
|
||||
<function name="PJSIP_MOH_PASSTHROUGH" language="en_US">
|
||||
<synopsis>
|
||||
Get or change the on-hold behavior for a SIP call.
|
||||
</synopsis>
|
||||
<syntax>
|
||||
</syntax>
|
||||
<description>
|
||||
<para>When read, returns the current moh passthrough mode</para>
|
||||
<para>When written, sets the current moh passthrough mode</para>
|
||||
<para>If <replaceable>yes</replaceable>, on-hold re-INVITEs are sent. If <replaceable>no</replaceable>, music on hold is generated.</para>
|
||||
<para>This function can be used to override the moh_passthrough configuration option</para>
|
||||
</description>
|
||||
</function>
|
||||
<function name="PJSIP_SEND_SESSION_REFRESH" language="en_US">
|
||||
<since>
|
||||
<version>13.12.0</version>
|
||||
<version>14.1.0</version>
|
||||
<version>15.0.0</version>
|
||||
</since>
|
||||
<synopsis>
|
||||
W/O: Initiate a session refresh via an UPDATE or re-INVITE on an established media session
|
||||
</synopsis>
|
||||
<syntax>
|
||||
<parameter name="update_type" required="false">
|
||||
<para>The type of update to send. Default is <literal>invite</literal>.</para>
|
||||
<enumlist>
|
||||
<enum name="invite">
|
||||
<para>Send the session refresh as a re-INVITE.</para>
|
||||
</enum>
|
||||
<enum name="update">
|
||||
<para>Send the session refresh as an UPDATE.</para>
|
||||
</enum>
|
||||
</enumlist>
|
||||
</parameter>
|
||||
</syntax>
|
||||
<description>
|
||||
<para>This function will cause the PJSIP stack to immediately refresh
|
||||
the media session for the channel. This will be done using either a
|
||||
re-INVITE (default) or an UPDATE request.
|
||||
</para>
|
||||
<para>This is most useful when combined with the <replaceable>PJSIP_MEDIA_OFFER</replaceable>
|
||||
dialplan function, as it allows the formats in use on a channel to be
|
||||
re-negotiated after call setup.</para>
|
||||
<warning>
|
||||
<para>The formats the endpoint supports are <emphasis>not</emphasis>
|
||||
checked or enforced by this function. Using this function to offer
|
||||
formats not supported by the endpoint <emphasis>may</emphasis> result
|
||||
in a loss of media.</para>
|
||||
</warning>
|
||||
<example title="Re-negotiate format to g722">
|
||||
; Within some existing extension on an answered channel
|
||||
same => n,Set(PJSIP_MEDIA_OFFER(audio)=!all,g722)
|
||||
same => n,Set(PJSIP_SEND_SESSION_REFRESH()=invite)
|
||||
</example>
|
||||
</description>
|
||||
<see-also>
|
||||
<ref type="function">PJSIP_MEDIA_OFFER</ref>
|
||||
</see-also>
|
||||
</function>
|
||||
<function name="PJSIP_PARSE_URI" language="en_US">
|
||||
<since>
|
||||
<version>13.24.0</version>
|
||||
<version>16.1.0</version>
|
||||
<version>17.0.0</version>
|
||||
</since>
|
||||
<synopsis>
|
||||
Parse an uri and return a type part of the URI.
|
||||
</synopsis>
|
||||
<syntax>
|
||||
<parameter name="uri" required="true">
|
||||
<para>URI to parse</para>
|
||||
</parameter>
|
||||
<parameter name="type" required="true">
|
||||
<para>The <literal>type</literal> parameter specifies which URI part to read</para>
|
||||
<enumlist>
|
||||
<enum name="display">
|
||||
<para>Display name.</para>
|
||||
</enum>
|
||||
<enum name="scheme">
|
||||
<para>URI scheme.</para>
|
||||
</enum>
|
||||
<enum name="user">
|
||||
<para>User part.</para>
|
||||
</enum>
|
||||
<enum name="passwd">
|
||||
<para>Password part.</para>
|
||||
</enum>
|
||||
<enum name="host">
|
||||
<para>Host part.</para>
|
||||
</enum>
|
||||
<enum name="port">
|
||||
<para>Port number, or zero.</para>
|
||||
</enum>
|
||||
<enum name="user_param">
|
||||
<para>User parameter.</para>
|
||||
</enum>
|
||||
<enum name="method_param">
|
||||
<para>Method parameter.</para>
|
||||
</enum>
|
||||
<enum name="transport_param">
|
||||
<para>Transport parameter.</para>
|
||||
</enum>
|
||||
<enum name="ttl_param">
|
||||
<para>TTL param, or -1.</para>
|
||||
</enum>
|
||||
<enum name="lr_param">
|
||||
<para>Loose routing param, or zero.</para>
|
||||
</enum>
|
||||
<enum name="maddr_param">
|
||||
<para>Maddr param.</para>
|
||||
</enum>
|
||||
</enumlist>
|
||||
</parameter>
|
||||
</syntax>
|
||||
<description>
|
||||
<para>Parse an URI and return a specified part of the URI.</para>
|
||||
</description>
|
||||
</function>
|
||||
|
||||
<info name="CHANNEL" language="en_US" tech="PJSIP">
|
||||
<enumlist>
|
||||
<enum name="rtp">
|
||||
<para>R/O Retrieve media related information.</para>
|
||||
<parameter name="type" required="true">
|
||||
<para>When <replaceable>rtp</replaceable> is specified, the
|
||||
<literal>type</literal> parameter must be provided. It specifies
|
||||
which RTP parameter to read.</para>
|
||||
<enumlist>
|
||||
<enum name="src">
|
||||
<para>Retrieve the local address for RTP.</para>
|
||||
</enum>
|
||||
<enum name="dest">
|
||||
<para>Retrieve the remote address for RTP.</para>
|
||||
</enum>
|
||||
<enum name="direct">
|
||||
<para>If direct media is enabled, this address is the remote address
|
||||
used for RTP.</para>
|
||||
</enum>
|
||||
<enum name="secure">
|
||||
<para>Whether or not the media stream is encrypted.</para>
|
||||
<enumlist>
|
||||
<enum name="0">
|
||||
<para>The media stream is not encrypted.</para>
|
||||
</enum>
|
||||
<enum name="1">
|
||||
<para>The media stream is encrypted.</para>
|
||||
</enum>
|
||||
</enumlist>
|
||||
</enum>
|
||||
<enum name="hold">
|
||||
<para>Whether or not the media stream is currently restricted
|
||||
due to a call hold.</para>
|
||||
<enumlist>
|
||||
<enum name="0">
|
||||
<para>The media stream is not held.</para>
|
||||
</enum>
|
||||
<enum name="1">
|
||||
<para>The media stream is held.</para>
|
||||
</enum>
|
||||
</enumlist>
|
||||
</enum>
|
||||
</enumlist>
|
||||
</parameter>
|
||||
<parameter name="media_type" required="false">
|
||||
<para>When <replaceable>rtp</replaceable> is specified, the
|
||||
<literal>media_type</literal> parameter may be provided. It specifies
|
||||
which media stream the chosen RTP parameter should be retrieved
|
||||
from.</para>
|
||||
<enumlist>
|
||||
<enum name="audio">
|
||||
<para>Retrieve information from the audio media stream.</para>
|
||||
<note><para>If not specified, <literal>audio</literal> is used
|
||||
by default.</para></note>
|
||||
</enum>
|
||||
<enum name="video">
|
||||
<para>Retrieve information from the video media stream.</para>
|
||||
</enum>
|
||||
</enumlist>
|
||||
</parameter>
|
||||
</enum>
|
||||
<enum name="rtcp">
|
||||
<para>R/O Retrieve RTCP statistics.</para>
|
||||
<parameter name="statistic" required="true">
|
||||
<para>When <replaceable>rtcp</replaceable> is specified, the
|
||||
<literal>statistic</literal> parameter must be provided. It specifies
|
||||
which RTCP statistic parameter to read.</para>
|
||||
<enumlist>
|
||||
<enum name="all">
|
||||
<para>Retrieve a summary of all RTCP statistics.</para>
|
||||
<para>The following data items are returned in a semi-colon
|
||||
delineated list:</para>
|
||||
<enumlist>
|
||||
<enum name="ssrc">
|
||||
<para>Our Synchronization Source identifier</para>
|
||||
</enum>
|
||||
<enum name="themssrc">
|
||||
<para>Their Synchronization Source identifier</para>
|
||||
</enum>
|
||||
<enum name="lp">
|
||||
<para>Our lost packet count</para>
|
||||
</enum>
|
||||
<enum name="rxjitter">
|
||||
<para>Received packet jitter</para>
|
||||
</enum>
|
||||
<enum name="rxcount">
|
||||
<para>Received packet count</para>
|
||||
</enum>
|
||||
<enum name="txjitter">
|
||||
<para>Transmitted packet jitter</para>
|
||||
</enum>
|
||||
<enum name="txcount">
|
||||
<para>Transmitted packet count</para>
|
||||
</enum>
|
||||
<enum name="rlp">
|
||||
<para>Remote lost packet count</para>
|
||||
</enum>
|
||||
<enum name="rtt">
|
||||
<para>Round trip time</para>
|
||||
</enum>
|
||||
<enum name="txmes">
|
||||
<para>Transmitted Media Experience Score</para>
|
||||
</enum>
|
||||
<enum name="rxmes">
|
||||
<para>Received Media Experience Score</para>
|
||||
</enum>
|
||||
</enumlist>
|
||||
</enum>
|
||||
<enum name="all_jitter">
|
||||
<para>Retrieve a summary of all RTCP Jitter statistics.</para>
|
||||
<para>The following data items are returned in a semi-colon
|
||||
delineated list:</para>
|
||||
<enumlist>
|
||||
<enum name="minrxjitter">
|
||||
<para>Our minimum jitter</para>
|
||||
</enum>
|
||||
<enum name="maxrxjitter">
|
||||
<para>Our max jitter</para>
|
||||
</enum>
|
||||
<enum name="avgrxjitter">
|
||||
<para>Our average jitter</para>
|
||||
</enum>
|
||||
<enum name="stdevrxjitter">
|
||||
<para>Our jitter standard deviation</para>
|
||||
</enum>
|
||||
<enum name="reported_minjitter">
|
||||
<para>Their minimum jitter</para>
|
||||
</enum>
|
||||
<enum name="reported_maxjitter">
|
||||
<para>Their max jitter</para>
|
||||
</enum>
|
||||
<enum name="reported_avgjitter">
|
||||
<para>Their average jitter</para>
|
||||
</enum>
|
||||
<enum name="reported_stdevjitter">
|
||||
<para>Their jitter standard deviation</para>
|
||||
</enum>
|
||||
</enumlist>
|
||||
</enum>
|
||||
<enum name="all_loss">
|
||||
<para>Retrieve a summary of all RTCP packet loss statistics.</para>
|
||||
<para>The following data items are returned in a semi-colon
|
||||
delineated list:</para>
|
||||
<enumlist>
|
||||
<enum name="minrxlost">
|
||||
<para>Our minimum lost packets</para>
|
||||
</enum>
|
||||
<enum name="maxrxlost">
|
||||
<para>Our max lost packets</para>
|
||||
</enum>
|
||||
<enum name="avgrxlost">
|
||||
<para>Our average lost packets</para>
|
||||
</enum>
|
||||
<enum name="stdevrxlost">
|
||||
<para>Our lost packets standard deviation</para>
|
||||
</enum>
|
||||
<enum name="reported_minlost">
|
||||
<para>Their minimum lost packets</para>
|
||||
</enum>
|
||||
<enum name="reported_maxlost">
|
||||
<para>Their max lost packets</para>
|
||||
</enum>
|
||||
<enum name="reported_avglost">
|
||||
<para>Their average lost packets</para>
|
||||
</enum>
|
||||
<enum name="reported_stdevlost">
|
||||
<para>Their lost packets standard deviation</para>
|
||||
</enum>
|
||||
</enumlist>
|
||||
</enum>
|
||||
<enum name="all_rtt">
|
||||
<para>Retrieve a summary of all RTCP round trip time information.</para>
|
||||
<para>The following data items are returned in a semi-colon
|
||||
delineated list:</para>
|
||||
<enumlist>
|
||||
<enum name="minrtt">
|
||||
<para>Minimum round trip time</para>
|
||||
</enum>
|
||||
<enum name="maxrtt">
|
||||
<para>Maximum round trip time</para>
|
||||
</enum>
|
||||
<enum name="avgrtt">
|
||||
<para>Average round trip time</para>
|
||||
</enum>
|
||||
<enum name="stdevrtt">
|
||||
<para>Standard deviation round trip time</para>
|
||||
</enum>
|
||||
</enumlist>
|
||||
</enum>
|
||||
<enum name="all_mes">
|
||||
<para>Retrieve a summary of all RTCP Media Experience Score information.</para>
|
||||
<para>The following data items are returned in a semi-colon
|
||||
delineated list:</para>
|
||||
<enumlist>
|
||||
<enum name="minmes">
|
||||
<para>Minimum MES based on us analysing received packets.</para>
|
||||
</enum>
|
||||
<enum name="maxmes">
|
||||
<para>Maximum MES based on us analysing received packets.</para>
|
||||
</enum>
|
||||
<enum name="avgmes">
|
||||
<para>Average MES based on us analysing received packets.</para>
|
||||
</enum>
|
||||
<enum name="stdevmes">
|
||||
<para>Standard deviation MES based on us analysing received packets.</para>
|
||||
</enum>
|
||||
<enum name="reported_minmes">
|
||||
<para>Minimum MES based on data we get in Sender and Receiver Reports sent by the remote end</para>
|
||||
</enum>
|
||||
<enum name="reported_maxmes">
|
||||
<para>Maximum MES based on data we get in Sender and Receiver Reports sent by the remote end</para>
|
||||
</enum>
|
||||
<enum name="reported_avgmes">
|
||||
<para>Average MES based on data we get in Sender and Receiver Reports sent by the remote end</para>
|
||||
</enum>
|
||||
<enum name="reported_stdevmes">
|
||||
<para>Standard deviation MES based on data we get in Sender and Receiver Reports sent by the remote end</para>
|
||||
</enum>
|
||||
</enumlist>
|
||||
</enum>
|
||||
<enum name="txcount"><para>Transmitted packet count</para></enum>
|
||||
<enum name="rxcount"><para>Received packet count</para></enum>
|
||||
<enum name="txjitter"><para>Transmitted packet jitter</para></enum>
|
||||
<enum name="rxjitter"><para>Received packet jitter</para></enum>
|
||||
<enum name="remote_maxjitter"><para>Their max jitter</para></enum>
|
||||
<enum name="remote_minjitter"><para>Their minimum jitter</para></enum>
|
||||
<enum name="remote_normdevjitter"><para>Their average jitter</para></enum>
|
||||
<enum name="remote_stdevjitter"><para>Their jitter standard deviation</para></enum>
|
||||
<enum name="local_maxjitter"><para>Our max jitter</para></enum>
|
||||
<enum name="local_minjitter"><para>Our minimum jitter</para></enum>
|
||||
<enum name="local_normdevjitter"><para>Our average jitter</para></enum>
|
||||
<enum name="local_stdevjitter"><para>Our jitter standard deviation</para></enum>
|
||||
<enum name="txploss"><para>Transmitted packet loss</para></enum>
|
||||
<enum name="rxploss"><para>Received packet loss</para></enum>
|
||||
<enum name="remote_maxrxploss"><para>Their max lost packets</para></enum>
|
||||
<enum name="remote_minrxploss"><para>Their minimum lost packets</para></enum>
|
||||
<enum name="remote_normdevrxploss"><para>Their average lost packets</para></enum>
|
||||
<enum name="remote_stdevrxploss"><para>Their lost packets standard deviation</para></enum>
|
||||
<enum name="local_maxrxploss"><para>Our max lost packets</para></enum>
|
||||
<enum name="local_minrxploss"><para>Our minimum lost packets</para></enum>
|
||||
<enum name="local_normdevrxploss"><para>Our average lost packets</para></enum>
|
||||
<enum name="local_stdevrxploss"><para>Our lost packets standard deviation</para></enum>
|
||||
<enum name="rtt"><para>Round trip time</para></enum>
|
||||
<enum name="maxrtt"><para>Maximum round trip time</para></enum>
|
||||
<enum name="minrtt"><para>Minimum round trip time</para></enum>
|
||||
<enum name="normdevrtt"><para>Average round trip time</para></enum>
|
||||
<enum name="stdevrtt"><para>Standard deviation round trip time</para></enum>
|
||||
<enum name="local_ssrc"><para>Our Synchronization Source identifier</para></enum>
|
||||
<enum name="remote_ssrc"><para>Their Synchronization Source identifier</para></enum>
|
||||
<enum name="txmes"><para>
|
||||
Current MES based on us analyzing rtt, jitter and loss
|
||||
in the actual received RTP stream received from the remote end.
|
||||
I.E. This is the MES for the incoming audio stream.
|
||||
</para></enum>
|
||||
<enum name="rxmes"><para>
|
||||
Current MES based on rtt and the jitter and loss values in
|
||||
RTCP sender and receiver reports we receive from the
|
||||
remote end. I.E. This is the MES for the outgoing audio stream.
|
||||
</para></enum>
|
||||
<enum name="remote_maxmes"><para>Max MES based on data we get in Sender and Receiver Reports sent by the remote end</para></enum>
|
||||
<enum name="remote_minmes"><para>Min MES based on data we get in Sender and Receiver Reports sent by the remote end</para></enum>
|
||||
<enum name="remote_normdevmes"><para>Average MES based on data we get in Sender and Receiver Reports sent by the remote end</para></enum>
|
||||
<enum name="remote_stdevmes"><para>Standard deviation MES based on data we get in Sender and Receiver Reports sent by the remote end</para></enum>
|
||||
<enum name="local_maxmes"><para>Max MES based on us analyzing the received RTP stream</para></enum>
|
||||
<enum name="local_minmes"><para>Min MES based on us analyzing the received RTP stream</para></enum>
|
||||
<enum name="local_normdevmes"><para>Average MES based on us analyzing the received RTP stream</para></enum>
|
||||
<enum name="local_stdevmes"><para>Standard deviation MES based on us analyzing the received RTP stream</para></enum>
|
||||
</enumlist>
|
||||
</parameter>
|
||||
<parameter name="media_type" required="false">
|
||||
<para>When <replaceable>rtcp</replaceable> is specified, the
|
||||
<literal>media_type</literal> parameter may be provided. It specifies
|
||||
which media stream the chosen RTCP parameter should be retrieved
|
||||
from.</para>
|
||||
<enumlist>
|
||||
<enum name="audio">
|
||||
<para>Retrieve information from the audio media stream.</para>
|
||||
<note><para>If not specified, <literal>audio</literal> is used
|
||||
by default.</para></note>
|
||||
</enum>
|
||||
<enum name="video">
|
||||
<para>Retrieve information from the video media stream.</para>
|
||||
</enum>
|
||||
</enumlist>
|
||||
</parameter>
|
||||
</enum>
|
||||
<enum name="endpoint">
|
||||
<para>R/O The name of the endpoint associated with this channel.
|
||||
Use the <replaceable>PJSIP_ENDPOINT</replaceable> function to obtain
|
||||
further endpoint related information.</para>
|
||||
</enum>
|
||||
<enum name="contact">
|
||||
<para>R/O The name of the contact associated with this channel.
|
||||
Use the <replaceable>PJSIP_CONTACT</replaceable> function to obtain
|
||||
further contact related information. Note this may not be present and if so
|
||||
is only available on outgoing legs.</para>
|
||||
</enum>
|
||||
<enum name="aor">
|
||||
<para>R/O The name of the AOR associated with this channel.
|
||||
Use the <replaceable>PJSIP_AOR</replaceable> function to obtain
|
||||
further AOR related information. Note this may not be present and if so
|
||||
is only available on outgoing legs.</para>
|
||||
</enum>
|
||||
<enum name="pjsip">
|
||||
<para>R/O Obtain information about the current PJSIP channel and its
|
||||
session.</para>
|
||||
<parameter name="type" required="true">
|
||||
<para>When <replaceable>pjsip</replaceable> is specified, the
|
||||
<literal>type</literal> parameter must be provided. It specifies
|
||||
which signalling parameter to read.</para>
|
||||
<enumlist>
|
||||
<enum name="call-id">
|
||||
<para>The SIP call-id.</para>
|
||||
</enum>
|
||||
<enum name="secure">
|
||||
<para>Whether or not the signalling uses a secure transport.</para>
|
||||
<enumlist>
|
||||
<enum name="0"><para>The signalling uses a non-secure transport.</para></enum>
|
||||
<enum name="1"><para>The signalling uses a secure transport.</para></enum>
|
||||
</enumlist>
|
||||
</enum>
|
||||
<enum name="target_uri">
|
||||
<para>The contact URI where requests are sent.</para>
|
||||
</enum>
|
||||
<enum name="local_uri">
|
||||
<para>The local URI.</para>
|
||||
</enum>
|
||||
<enum name="local_tag">
|
||||
<para>Tag in From header</para>
|
||||
</enum>
|
||||
<enum name="remote_uri">
|
||||
<para>The remote URI.</para>
|
||||
</enum>
|
||||
<enum name="remote_tag">
|
||||
<para>Tag in To header</para>
|
||||
</enum>
|
||||
<enum name="request_uri">
|
||||
<para>The request URI of the incoming <literal>INVITE</literal>
|
||||
associated with the creation of this channel.</para>
|
||||
</enum>
|
||||
<enum name="t38state">
|
||||
<para>The current state of any T.38 fax on this channel.</para>
|
||||
<enumlist>
|
||||
<enum name="DISABLED"><para>T.38 faxing is disabled on this channel.</para></enum>
|
||||
<enum name="LOCAL_REINVITE"><para>Asterisk has sent a <literal>re-INVITE</literal> to the remote end to initiate a T.38 fax.</para></enum>
|
||||
<enum name="REMOTE_REINVITE"><para>The remote end has sent a <literal>re-INVITE</literal> to Asterisk to initiate a T.38 fax.</para></enum>
|
||||
<enum name="ENABLED"><para>A T.38 fax session has been enabled.</para></enum>
|
||||
<enum name="REJECTED"><para>A T.38 fax session was attempted but was rejected.</para></enum>
|
||||
</enumlist>
|
||||
</enum>
|
||||
<enum name="local_addr">
|
||||
<para>On inbound calls, the full IP address and port number that
|
||||
the <literal>INVITE</literal> request was received on. On outbound
|
||||
calls, the full IP address and port number that the <literal>INVITE</literal>
|
||||
request was transmitted from.</para>
|
||||
</enum>
|
||||
<enum name="remote_addr">
|
||||
<para>On inbound calls, the full IP address and port number that
|
||||
the <literal>INVITE</literal> request was received from. On outbound
|
||||
calls, the full IP address and port number that the <literal>INVITE</literal>
|
||||
request was transmitted to.</para>
|
||||
</enum>
|
||||
</enumlist>
|
||||
</parameter>
|
||||
</enum>
|
||||
</enumlist>
|
||||
</info>
|
||||
<info name="CHANNEL_EXAMPLES" language="en_US" tech="PJSIP">
|
||||
<example title="PJSIP specific CHANNEL examples">
|
||||
; Log the current Call-ID
|
||||
same => n,Log(NOTICE, ${CHANNEL(pjsip,call-id)})
|
||||
|
||||
; Log the destination address of the audio stream
|
||||
same => n,Log(NOTICE, ${CHANNEL(rtp,dest)})
|
||||
|
||||
; Store the round-trip time associated with a
|
||||
; video stream in the CDR field video-rtt
|
||||
same => n,Set(CDR(video-rtt)=${CHANNEL(rtcp,rtt,video)})
|
||||
</example>
|
||||
</info>
|
||||
</docs>
|
|
@ -148,4 +148,24 @@ int pjsip_acf_dial_contacts_read(struct ast_channel *chan, const char *cmd, char
|
|||
*/
|
||||
int pjsip_acf_parse_uri_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len);
|
||||
|
||||
#endif /* _PJSIP_DIALPLAN_FUNCTIONS */
|
||||
/*!
|
||||
* \brief Hang up an incoming PJSIP channel with a SIP response code
|
||||
* \param chan The channel the function is called on
|
||||
* \param data SIP response code or name
|
||||
*
|
||||
* \retval 0 on success
|
||||
* \retval -1 on failure
|
||||
*/
|
||||
int pjsip_app_hangup(struct ast_channel *chan, const char *data);
|
||||
|
||||
/*!
|
||||
* \brief Manager action to hang up an incoming PJSIP channel with a SIP response code
|
||||
* \param s session
|
||||
* \param m message
|
||||
*
|
||||
* \retval 0 on success
|
||||
* \retval -1 on failure
|
||||
*/
|
||||
int pjsip_action_hangup(struct mansession *s, const struct message *m);
|
||||
|
||||
#endif /* _PJSIP_DIALPLAN_FUNCTIONS */
|
||||
|
|
|
@ -805,6 +805,11 @@ int analog_available(struct analog_pvt *p)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* If line is being held, definitely not (don't allow call waitings to an on-hook phone) */
|
||||
if (p->cshactive) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* If no owner definitely available */
|
||||
if (!p->owner) {
|
||||
offhook = analog_is_off_hook(p);
|
||||
|
@ -1300,6 +1305,7 @@ int analog_hangup(struct analog_pvt *p, struct ast_channel *ast)
|
|||
p->channel, idx, p->subs[ANALOG_SUB_REAL].allocd, p->subs[ANALOG_SUB_CALLWAIT].allocd, p->subs[ANALOG_SUB_THREEWAY].allocd);
|
||||
if (idx > -1) {
|
||||
/* Real channel, do some fixup */
|
||||
p->cshactive = 0;
|
||||
p->subs[idx].owner = NULL;
|
||||
p->polarity = POLARITY_IDLE;
|
||||
analog_set_linear_mode(p, idx, 0);
|
||||
|
@ -1758,10 +1764,7 @@ static void *__analog_ss_thread(void *data)
|
|||
|
||||
ast_debug(1, "%s %d\n", __FUNCTION__, p->channel);
|
||||
|
||||
if (!chan) {
|
||||
/* What happened to the channel? */
|
||||
goto quit;
|
||||
}
|
||||
ast_assert(chan != NULL);
|
||||
|
||||
if ((callid = ast_channel_callid(chan))) {
|
||||
ast_callid_threadassoc_add(callid);
|
||||
|
@ -2750,6 +2753,7 @@ int analog_ss_thread_start(struct analog_pvt *p, struct ast_channel *chan)
|
|||
{
|
||||
pthread_t threadid;
|
||||
|
||||
p->ss_astchan = chan;
|
||||
return ast_pthread_create_detached(&threadid, NULL, __analog_ss_thread, p);
|
||||
}
|
||||
|
||||
|
@ -2933,6 +2937,34 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_
|
|||
analog_get_and_handle_alarms(p);
|
||||
cause_code->ast_cause = AST_CAUSE_NETWORK_OUT_OF_ORDER;
|
||||
case ANALOG_EVENT_ONHOOK:
|
||||
if (p->calledsubscriberheld && (p->sig == ANALOG_SIG_FXOLS || p->sig == ANALOG_SIG_FXOGS || p->sig == ANALOG_SIG_FXOKS) && idx == ANALOG_SUB_REAL) {
|
||||
ast_debug(4, "Channel state on %s is %d\n", ast_channel_name(ast), ast_channel_state(ast));
|
||||
/* Called Subscriber Held: don't let the called party hang up on an incoming call immediately (if it's the only call). */
|
||||
if (p->subs[ANALOG_SUB_CALLWAIT].owner || p->subs[ANALOG_SUB_THREEWAY].owner) {
|
||||
ast_debug(2, "Letting this call hang up normally, since it's not the only call\n");
|
||||
} else if (!p->owner || !p->subs[ANALOG_SUB_REAL].owner || ast_channel_state(ast) != AST_STATE_UP) {
|
||||
ast_debug(2, "Called Subscriber Held does not apply: channel state is %d\n", ast_channel_state(ast));
|
||||
} else if (!p->owner || !p->subs[ANALOG_SUB_REAL].owner || strcmp(ast_channel_appl(p->subs[ANALOG_SUB_REAL].owner), "AppDial")) {
|
||||
/* Called Subscriber held only applies to incoming calls, not outgoing calls.
|
||||
* We can't use p->outgoing because that is always true, for both incoming and outgoing calls, so it's not accurate.
|
||||
* We can check the channel application/data instead.
|
||||
* For incoming calls to the channel, it will look like: AppDial / (Outgoing Line)
|
||||
* We only want this behavior for regular calls anyways (and not, say, Queue),
|
||||
* so this would actually work great. But accessing ast_channel_appl can cause a crash if there are no calls left,
|
||||
* so this check must occur AFTER we confirm the channel state *is* still UP.
|
||||
*/
|
||||
ast_debug(2, "Called Subscriber Held does not apply: not an incoming call\n");
|
||||
} else if (analog_is_off_hook(p)) {
|
||||
ast_log(LOG_WARNING, "Got ONHOOK but channel %d is off hook?\n", p->channel); /* Shouldn't happen */
|
||||
} else {
|
||||
ast_verb(3, "Holding incoming call %s for channel %d\n", ast_channel_name(ast), p->channel);
|
||||
/* Inhibit dahdi_hangup from getting called, and do nothing else now.
|
||||
* When the DAHDI channel goes off hook again, it'll just get reconnected with the incoming call,
|
||||
* to which, as far as its concerned, nothing has happened. */
|
||||
p->cshactive = 1; /* Keep track that this DAHDI channel is currently being held by an incoming call. */
|
||||
break;
|
||||
}
|
||||
}
|
||||
ast_queue_control_data(ast, AST_CONTROL_PVT_CAUSE_CODE, cause_code, data_size);
|
||||
ast_channel_hangupcause_hash_set(ast, cause_code, data_size);
|
||||
switch (p->sig) {
|
||||
|
@ -3809,6 +3841,7 @@ void *analog_handle_init_event(struct analog_pvt *i, int event)
|
|||
case ANALOG_SIG_FXOKS:
|
||||
res = analog_off_hook(i);
|
||||
i->fxsoffhookstate = 1;
|
||||
i->cshactive = 0;
|
||||
if (res && (errno == EBUSY)) {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -289,6 +289,7 @@ struct analog_pvt {
|
|||
unsigned int ani_wink_time:16; /* Safe wait time before we wink to start ANI spill */
|
||||
|
||||
unsigned int answeronpolarityswitch:1;
|
||||
unsigned int calledsubscriberheld:1; /*!< TRUE if a single incoming call can hold an FXS channel */
|
||||
unsigned int callreturn:1;
|
||||
unsigned int cancallforward:1;
|
||||
unsigned int canpark:1;
|
||||
|
@ -330,6 +331,7 @@ struct analog_pvt {
|
|||
|
||||
/* XXX: All variables after this are internal */
|
||||
unsigned int callwaiting:1; /*!< TRUE if call waiting is enabled. (Active option) */
|
||||
unsigned int cshactive:1; /*!< TRUE if FXS channel is currently held by an incoming call */
|
||||
unsigned int dialednone:1;
|
||||
unsigned int dialing:1; /*!< TRUE if in the process of dialing digits or sending something */
|
||||
unsigned int dnd:1; /*!< TRUE if Do-Not-Disturb is enabled. */
|
||||
|
|
|
@ -597,20 +597,20 @@ static int parse_config(int reload)
|
|||
if (!strcasecmp(var->name, "quality")) {
|
||||
res = abs(atoi(var->value));
|
||||
if (res > -1 && res < 11) {
|
||||
ast_verb(3, "CODEC SPEEX: Setting Quality to %d\n",res);
|
||||
ast_verb(5, "CODEC SPEEX: Setting Quality to %d\n",res);
|
||||
quality = res;
|
||||
} else
|
||||
ast_log(LOG_ERROR,"Error Quality must be 0-10\n");
|
||||
} else if (!strcasecmp(var->name, "complexity")) {
|
||||
res = abs(atoi(var->value));
|
||||
if (res > -1 && res < 11) {
|
||||
ast_verb(3, "CODEC SPEEX: Setting Complexity to %d\n",res);
|
||||
ast_verb(5, "CODEC SPEEX: Setting Complexity to %d\n",res);
|
||||
complexity = res;
|
||||
} else
|
||||
ast_log(LOG_ERROR,"Error! Complexity must be 0-10\n");
|
||||
} else if (!strcasecmp(var->name, "vbr_quality")) {
|
||||
if (sscanf(var->value, "%30f", &res_f) == 1 && res_f >= 0 && res_f <= 10) {
|
||||
ast_verb(3, "CODEC SPEEX: Setting VBR Quality to %f\n",res_f);
|
||||
ast_verb(5, "CODEC SPEEX: Setting VBR Quality to %f\n",res_f);
|
||||
vbr_quality = res_f;
|
||||
} else
|
||||
ast_log(LOG_ERROR,"Error! VBR Quality must be 0-10\n");
|
||||
|
@ -618,62 +618,62 @@ static int parse_config(int reload)
|
|||
ast_log(LOG_ERROR,"Error! ABR Quality setting obsolete, set ABR to desired bitrate\n");
|
||||
} else if (!strcasecmp(var->name, "enhancement")) {
|
||||
enhancement = ast_true(var->value) ? 1 : 0;
|
||||
ast_verb(3, "CODEC SPEEX: Perceptual Enhancement Mode. [%s]\n",enhancement ? "on" : "off");
|
||||
ast_verb(5, "CODEC SPEEX: Perceptual Enhancement Mode. [%s]\n",enhancement ? "on" : "off");
|
||||
} else if (!strcasecmp(var->name, "vbr")) {
|
||||
vbr = ast_true(var->value) ? 1 : 0;
|
||||
ast_verb(3, "CODEC SPEEX: VBR Mode. [%s]\n",vbr ? "on" : "off");
|
||||
ast_verb(5, "CODEC SPEEX: VBR Mode. [%s]\n",vbr ? "on" : "off");
|
||||
} else if (!strcasecmp(var->name, "abr")) {
|
||||
res = abs(atoi(var->value));
|
||||
if (res >= 0) {
|
||||
if (res > 0)
|
||||
ast_verb(3, "CODEC SPEEX: Setting ABR target bitrate to %d\n",res);
|
||||
ast_verb(5, "CODEC SPEEX: Setting ABR target bitrate to %d\n",res);
|
||||
else
|
||||
ast_verb(3, "CODEC SPEEX: Disabling ABR\n");
|
||||
ast_verb(5, "CODEC SPEEX: Disabling ABR\n");
|
||||
abr = res;
|
||||
} else
|
||||
ast_log(LOG_ERROR,"Error! ABR target bitrate must be >= 0\n");
|
||||
} else if (!strcasecmp(var->name, "vad")) {
|
||||
vad = ast_true(var->value) ? 1 : 0;
|
||||
ast_verb(3, "CODEC SPEEX: VAD Mode. [%s]\n",vad ? "on" : "off");
|
||||
ast_verb(5, "CODEC SPEEX: VAD Mode. [%s]\n",vad ? "on" : "off");
|
||||
} else if (!strcasecmp(var->name, "dtx")) {
|
||||
dtx = ast_true(var->value) ? 1 : 0;
|
||||
ast_verb(3, "CODEC SPEEX: DTX Mode. [%s]\n",dtx ? "on" : "off");
|
||||
ast_verb(5, "CODEC SPEEX: DTX Mode. [%s]\n",dtx ? "on" : "off");
|
||||
} else if (!strcasecmp(var->name, "preprocess")) {
|
||||
preproc = ast_true(var->value) ? 1 : 0;
|
||||
ast_verb(3, "CODEC SPEEX: Preprocessing. [%s]\n",preproc ? "on" : "off");
|
||||
ast_verb(5, "CODEC SPEEX: Preprocessing. [%s]\n",preproc ? "on" : "off");
|
||||
} else if (!strcasecmp(var->name, "pp_vad")) {
|
||||
pp_vad = ast_true(var->value) ? 1 : 0;
|
||||
ast_verb(3, "CODEC SPEEX: Preprocessor VAD. [%s]\n",pp_vad ? "on" : "off");
|
||||
ast_verb(5, "CODEC SPEEX: Preprocessor VAD. [%s]\n",pp_vad ? "on" : "off");
|
||||
} else if (!strcasecmp(var->name, "pp_agc")) {
|
||||
pp_agc = ast_true(var->value) ? 1 : 0;
|
||||
ast_verb(3, "CODEC SPEEX: Preprocessor AGC. [%s]\n",pp_agc ? "on" : "off");
|
||||
ast_verb(5, "CODEC SPEEX: Preprocessor AGC. [%s]\n",pp_agc ? "on" : "off");
|
||||
} else if (!strcasecmp(var->name, "pp_agc_level")) {
|
||||
if (sscanf(var->value, "%30f", &res_f) == 1 && res_f >= 0) {
|
||||
ast_verb(3, "CODEC SPEEX: Setting preprocessor AGC Level to %f\n",res_f);
|
||||
ast_verb(5, "CODEC SPEEX: Setting preprocessor AGC Level to %f\n",res_f);
|
||||
pp_agc_level = res_f;
|
||||
} else
|
||||
ast_log(LOG_ERROR,"Error! Preprocessor AGC Level must be >= 0\n");
|
||||
} else if (!strcasecmp(var->name, "pp_denoise")) {
|
||||
pp_denoise = ast_true(var->value) ? 1 : 0;
|
||||
ast_verb(3, "CODEC SPEEX: Preprocessor Denoise. [%s]\n",pp_denoise ? "on" : "off");
|
||||
ast_verb(5, "CODEC SPEEX: Preprocessor Denoise. [%s]\n",pp_denoise ? "on" : "off");
|
||||
} else if (!strcasecmp(var->name, "pp_dereverb")) {
|
||||
pp_dereverb = ast_true(var->value) ? 1 : 0;
|
||||
ast_verb(3, "CODEC SPEEX: Preprocessor Dereverb. [%s]\n",pp_dereverb ? "on" : "off");
|
||||
ast_verb(5, "CODEC SPEEX: Preprocessor Dereverb. [%s]\n",pp_dereverb ? "on" : "off");
|
||||
} else if (!strcasecmp(var->name, "pp_dereverb_decay")) {
|
||||
if (sscanf(var->value, "%30f", &res_f) == 1 && res_f >= 0) {
|
||||
ast_verb(3, "CODEC SPEEX: Setting preprocessor Dereverb Decay to %f\n",res_f);
|
||||
ast_verb(5, "CODEC SPEEX: Setting preprocessor Dereverb Decay to %f\n",res_f);
|
||||
pp_dereverb_decay = res_f;
|
||||
} else
|
||||
ast_log(LOG_ERROR,"Error! Preprocessor Dereverb Decay must be >= 0\n");
|
||||
} else if (!strcasecmp(var->name, "pp_dereverb_level")) {
|
||||
if (sscanf(var->value, "%30f", &res_f) == 1 && res_f >= 0) {
|
||||
ast_verb(3, "CODEC SPEEX: Setting preprocessor Dereverb Level to %f\n",res_f);
|
||||
ast_verb(5, "CODEC SPEEX: Setting preprocessor Dereverb Level to %f\n",res_f);
|
||||
pp_dereverb_level = res_f;
|
||||
} else
|
||||
ast_log(LOG_ERROR,"Error! Preprocessor Dereverb Level must be >= 0\n");
|
||||
} else if (!strcasecmp(var->name, "experimental_rtcp_feedback")) {
|
||||
exp_rtcp_fb = ast_true(var->value) ? 1 : 0;
|
||||
ast_verb(3, "CODEC SPEEX: Experimental RTCP Feedback. [%s]\n",exp_rtcp_fb ? "on" : "off");
|
||||
ast_verb(5, "CODEC SPEEX: Experimental RTCP Feedback. [%s]\n",exp_rtcp_fb ? "on" : "off");
|
||||
}
|
||||
}
|
||||
ast_config_destroy(cfg);
|
||||
|
|
|
@ -8,8 +8,8 @@ If you intend to use this configuration as a template for your own, then
|
|||
you will need to change many values in the various configuration files to
|
||||
match your own devices, network, SIP ITSP accounts and more.
|
||||
|
||||
For further documentation on this configuration see the Asterisk wiki:
|
||||
https://wiki.asterisk.org/wiki/display/AST/Reference+Use+Cases+for+Asterisk.
|
||||
For further documentation on this configuration see the Asterisk documentation:
|
||||
https://docs.asterisk.org/Deployment/Reference-Use-Cases-for-Asterisk/.
|
||||
|
||||
Please report bugs or errors in configuration on the Asterisk issue tracker:
|
||||
https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines
|
||||
https://docs.asterisk.org/Asterisk-Community/Asterisk-Issue-Guidelines/
|
||||
|
|
|
@ -126,6 +126,10 @@ documentation_language = en_US ; Set the language you want documentation
|
|||
; housekeeping AMI and ARI channel events. This can
|
||||
; reduce the load on the manager and ARI applications
|
||||
; when the Digium Phone Module for Asterisk is in use.
|
||||
;sounds_search_custom_dir = no; This option, if enabled, will
|
||||
; cause Asterisk to search for sounds files in
|
||||
; AST_DATA_DIR/sounds/custom before searching the
|
||||
; normal directories like AST_DATA_DIR/sounds/<lang>.
|
||||
|
||||
; Changing the following lines may compromise your security.
|
||||
;[files]
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
; --- Call Completion Supplementary Services ---
|
||||
;
|
||||
; For more information about CCSS, see the CCSS user documentation
|
||||
; https://wiki.asterisk.org/wiki/display/AST/Call+Completion+Supplementary+Services+(CCSS)
|
||||
; https://docs.asterisk.org/Deployment/PSTN-Connectivity/Call-Completion-Supplementary-Services-CCSS/
|
||||
;
|
||||
|
||||
[general]
|
||||
|
|
|
@ -595,7 +595,7 @@ usecallerid=yes
|
|||
; polarity = polarity reversal signals the start
|
||||
; polarity_IN = polarity reversal signals the start, for India,
|
||||
; for dtmf dialtone detection; using DTMF.
|
||||
; (see https://wiki.asterisk.org/wiki/display/AST/Caller+ID+in+India)
|
||||
; (see https://wiki.asterisk.org/wiki/display/AST/Caller+ID+in+India)
|
||||
; dtmf = causes monitor loop to look for dtmf energy on the
|
||||
; incoming channel to initate cid acquisition
|
||||
;
|
||||
|
@ -755,6 +755,18 @@ usecallingpres=yes
|
|||
;
|
||||
callwaitingcallerid=yes
|
||||
;
|
||||
; Whether or not to allow users to go on-hook when receiving an incoming call
|
||||
; without disconnecting it. Users can later resume the call from any phone
|
||||
; on the same physical phone line (the same DAHDI channel).
|
||||
; This setting only has an effect on FXS (FXO-signalled) channels where there
|
||||
; is only a single incoming call to the DAHDI channel, using the Dial application.
|
||||
; (This is a convenience mechanism to avoid users wishing to resume a conversation
|
||||
; at a different phone from leaving a phone off the hook, resuming elsewhere,
|
||||
; and forgetting to restore the original phone on hook afterwards.)
|
||||
; Default is no.
|
||||
;
|
||||
;calledsubscriberheld=yes
|
||||
;
|
||||
; Support three-way calling
|
||||
;
|
||||
threewaycalling=yes
|
||||
|
@ -932,6 +944,10 @@ group=1
|
|||
; you can answer it by picking up and dialing *8#. For simple offices, just
|
||||
; make these both the same. Groups range from 0 to 63.
|
||||
;
|
||||
; Call groups and pickup groups may only be specified for FXO signalled channels.
|
||||
; If you need to pick up an FXS signalled channel directly, you can have it
|
||||
; dial a Local channel and pick up the ;1 side of the Local channel instead.
|
||||
;
|
||||
callgroup=1
|
||||
pickupgroup=1
|
||||
;
|
||||
|
@ -1563,7 +1579,7 @@ pickupgroup=1
|
|||
;#include ss7.timers
|
||||
|
||||
; For more information on setting up SS7, see the README file in libss7 or
|
||||
; https://wiki.asterisk.org/wiki/display/AST/Signaling+System+Number+7
|
||||
; https://docs.asterisk.org/Deployment/PSTN-Connectivity/Signaling-System-Number-7/
|
||||
; ----------------- SS7 Options ----------------------------------------
|
||||
|
||||
; ---------------- Options for use with signalling=mfcr2 --------------
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
;bindaddr=0.0.0.0
|
||||
;port=4520
|
||||
;
|
||||
; See https://wiki.asterisk.org/wiki/display/AST/IP+Quality+of+Service for a description of the tos parameter.
|
||||
; See https://docs.asterisk.org/Configuration/Channel-Drivers/IP-Quality-of-Service for a description of the tos parameter.
|
||||
;tos=ef
|
||||
;
|
||||
; Our entity identifier. (It should generally be the MAC address of the
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
; Static and realtime external configuration
|
||||
; engine configuration
|
||||
;
|
||||
; See https://wiki.asterisk.org/wiki/display/AST/Realtime+Database+Configuration
|
||||
; See https://docs.asterisk.org/Fundamentals/Asterisk-Configuration/Database-Support-Configuration/Realtime-Database-Configuration/
|
||||
; for basic table formatting information.
|
||||
;
|
||||
[settings]
|
||||
|
@ -84,6 +84,7 @@
|
|||
;ps_outbound_publishes => odbc,asterisk
|
||||
;ps_inbound_publications = odbc,asterisk
|
||||
;ps_asterisk_publications = odbc,asterisk
|
||||
;stir_tn => odbc,asterisk
|
||||
;voicemail => odbc,asterisk
|
||||
;extensions => odbc,asterisk
|
||||
;meetme => mysql,general
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
;--
|
||||
Geolocation Profile Sample Configuration
|
||||
|
||||
Please see https://wiki.asterisk.org/wiki/display/AST/Geolocation
|
||||
Please see https://docs.asterisk.org/Deployment/Geolocation/
|
||||
for the most current information.
|
||||
--;
|
||||
|
||||
|
@ -33,7 +33,7 @@ incoming calls (Asterisk is the UAS) and and one for outgoing calls
|
|||
|
||||
NOTE:
|
||||
|
||||
See https://wiki.asterisk.org/wiki/display/AST/Geolocation for the most
|
||||
See https://docs.asterisk.org/Deployment/Geolocation/ for the most
|
||||
complete and up-to-date information on valid values for the object
|
||||
parameters and a full list of references.
|
||||
|
||||
|
@ -96,7 +96,7 @@ variables like ${EXTEN}, channel variables you may have added in the
|
|||
dialplan, or variables you may have specified in the profile that
|
||||
references this location object.
|
||||
|
||||
NOTE: See https://wiki.asterisk.org/wiki/display/AST/Geolocation for the
|
||||
NOTE: See https://docs.asterisk.org/Deployment/Geolocation/ for the
|
||||
most complete and up-to-date information on valid values for the object
|
||||
parameters and a full list of references.
|
||||
|
||||
|
|
|
@ -140,9 +140,13 @@
|
|||
|
||||
;
|
||||
; Specify bandwidth of low, medium, or high to control which codecs are used
|
||||
; in general.
|
||||
; in general. This setting will restrict codecs used to only those that comply
|
||||
; with the bandwidth setting. In most cases, you should set this to 'high' so
|
||||
; that high-quality codecs may be used; if set to a lower value, this will
|
||||
; degrade call quality, so you probably only want to do this if you have
|
||||
; actual significant bandwidth constraints.
|
||||
;
|
||||
bandwidth=low
|
||||
bandwidth=high
|
||||
;
|
||||
|
||||
;
|
||||
|
@ -323,7 +327,7 @@ encryption=yes
|
|||
;
|
||||
;authdebug = yes
|
||||
;
|
||||
; See https://wiki.asterisk.org/wiki/display/AST/IP+Quality+of+Service for a description of these parameters.
|
||||
; See https://docs.asterisk.org/Configuration/Channel-Drivers/IP-Quality-of-Service for a description of these parameters.
|
||||
;tos=ef
|
||||
;cos=5
|
||||
;
|
||||
|
|
|
@ -53,7 +53,7 @@ codec=ulaw
|
|||
;
|
||||
flags=register,heartbeat
|
||||
;
|
||||
; See https://wiki.asterisk.org/wiki/display/AST/IP+Quality+of+Service for a description of this parameter.
|
||||
; See https://docs.asterisk.org/Configuration/Channel-Drivers/IP-Quality-of-Service for a description of this parameter.
|
||||
;tos=ef
|
||||
;
|
||||
; Example iaxy provisioning
|
||||
|
|
|
@ -38,6 +38,10 @@
|
|||
; - 5: trace
|
||||
; - 6: more detailed trace
|
||||
;
|
||||
; Note: setting the pjproject debug level to 4 (debug) or above may result in
|
||||
; raw packets being logged. This should only be enabled during active debugging
|
||||
; to avoid a potential security issue due to logging injection.
|
||||
;
|
||||
;asterisk_error = ; A comma separated list of pjproject log levels to map to
|
||||
; Asterisk errors.
|
||||
; (default: "0,1")
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
; Documentation
|
||||
;
|
||||
; The official documentation is at http://wiki.asterisk.org
|
||||
; The official documentation is at https://docs.asterisk.org
|
||||
; You can read the XML configuration help via Asterisk command line with
|
||||
; "config show help res_pjsip", then you can drill down through the various
|
||||
; sections and their options.
|
||||
|
@ -31,8 +31,8 @@
|
|||
; At a minimum please read the file "README-SERIOUSLY.bestpractices.txt",
|
||||
; located in the Asterisk source directory before starting Asterisk.
|
||||
; Otherwise you risk allowing the security of the Asterisk system to be
|
||||
; compromised. Beyond that please visit and read the security information on
|
||||
; the wiki at: https://wiki.asterisk.org/wiki/x/EwFB
|
||||
; compromised. Beyond that please visit and read the security information in
|
||||
; the documentation at: https://docs.asterisk.org/Deployment/Important-Security-Considerations/
|
||||
;
|
||||
; A few basics to pay attention to:
|
||||
;
|
||||
|
@ -47,7 +47,7 @@
|
|||
;
|
||||
; See the example ACL configuration in this file. Read the configuration help
|
||||
; for the section and all of its options. Look over the samples in acl.conf
|
||||
; and documentation at https://wiki.asterisk.org/wiki/x/uA80AQ
|
||||
; and documentation at https://docs.asterisk.org/Configuration/Core-Configuration/Named-ACLs/
|
||||
; If possible, restrict access to only networks and addresses you trust.
|
||||
;
|
||||
; Dialplan Contexts
|
||||
|
@ -175,7 +175,7 @@
|
|||
;
|
||||
; This is a simple registration that works with some SIP trunking providers.
|
||||
; You'll need to set up the auth example "mytrunk_auth" below to enable outbound
|
||||
; authentication. Note that we "outbound_auth=" use for outbound authentication
|
||||
; authentication. Note that we use "outbound_auth=" for outbound authentication
|
||||
; instead of "auth=", which is for inbound authentication.
|
||||
;
|
||||
; If you are registering to a server from behind NAT, be sure you assign a transport
|
||||
|
@ -393,7 +393,7 @@
|
|||
;rewrite_contact=yes ; necessary if endpoint does not know/register public ip:port
|
||||
;ice_support=yes ;This is specific to clients that support NAT traversal
|
||||
;for media via ICE,STUN,TURN. See the wiki at:
|
||||
;https://wiki.asterisk.org/wiki/x/D4FHAQ
|
||||
;https://docs.asterisk.org/Configuration/Miscellaneous/Interactive-Connectivity-Establishment-ICE-in-Asterisk/
|
||||
;for a deeper explanation of this topic.
|
||||
|
||||
;[6002]
|
||||
|
@ -1454,7 +1454,7 @@
|
|||
|
||||
; MODULE PROVIDING BELOW SECTION(S): res_pjsip_outbound_publish
|
||||
;======================OUTBOUND_PUBLISH SECTION OPTIONS=====================
|
||||
; See https://wiki.asterisk.org/wiki/display/AST/Publishing+Extension+State
|
||||
; See https://docs.asterisk.org/Configuration/Channel-Drivers/SIP/Configuring-res_pjsip/Publishing-Extension-State/
|
||||
; for more information.
|
||||
;[outbound-publish]
|
||||
;type=outbound-publish ; Must be of type 'outbound-publish'.
|
||||
|
@ -1509,9 +1509,9 @@
|
|||
|
||||
|
||||
; MODULE PROVIDING BELOW SECTION(S): res_pjsip_pubsub
|
||||
;=============================RESOURCE-LIST===================================
|
||||
; See https://wiki.asterisk.org/wiki/pages/viewpage.action?pageId=30278158
|
||||
; See https://docs.asterisk.org/Configuration/Channel-Drivers/SIP/Configuring-res_pjsip/Resource-List-Subscriptions-RLS/
|
||||
; for more information.
|
||||
;=============================RESOURCE-LIST===================================
|
||||
;[resource_list]
|
||||
;type=resource_list ; Must be of type 'resource_list'.
|
||||
|
||||
|
@ -1568,7 +1568,7 @@
|
|||
|
||||
|
||||
;==========================INBOUND_PUBLICATION================================
|
||||
; See https://wiki.asterisk.org/wiki/display/AST/Exchanging+Device+and+Mailbox+State+Using+PJSIP
|
||||
; See https://docs.asterisk.org/Configuration/Channel-Drivers/SIP/Configuring-res_pjsip/Exchanging-Device-and-Mailbox-State-Using-PJSIP/
|
||||
; for more information.
|
||||
;[inbound-publication]
|
||||
;type= ; Must be of type 'inbound-publication'.
|
||||
|
@ -1579,7 +1579,7 @@
|
|||
|
||||
; MODULE PROVIDING BELOW SECTION(S): res_pjsip_publish_asterisk
|
||||
;==========================ASTERISK_PUBLICATION===============================
|
||||
; See https://wiki.asterisk.org/wiki/display/AST/Exchanging+Device+and+Mailbox+State+Using+PJSIP
|
||||
; See https://docs.asterisk.org/Configuration/Channel-Drivers/SIP/Configuring-res_pjsip/Exchanging-Device-and-Mailbox-State-Using-PJSIP/
|
||||
; for more information.
|
||||
;[asterisk-publication]
|
||||
;type=asterisk-publication ; Must be of type 'asterisk-publication'.
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
; Documentation
|
||||
;
|
||||
; The official documentation is at http://wiki.asterisk.org
|
||||
; The official documentation is at https://docs.asterisk.org
|
||||
; You can read the XML configuration help via Asterisk command line with
|
||||
; "config show help res_pjsip_config_wizard", then you can drill down through
|
||||
; the various sections and their options.
|
||||
|
|
|
@ -286,6 +286,13 @@ monitor-type = MixMonitor
|
|||
;
|
||||
;periodic-announce-frequency=60
|
||||
;
|
||||
; If given indicates the number of seconds after entering the queue the first
|
||||
; periodic announcement should be played. The default (and historic) behavior
|
||||
; is to play the first periodic announcement at periodic-announce-frequency
|
||||
; seconds after entering the queue.
|
||||
;
|
||||
;periodic-announce-startdelay=10
|
||||
;
|
||||
; Should the periodic announcements be played in a random order? Default is no.
|
||||
;
|
||||
;random-periodic-announce=no
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
;
|
||||
; Sample configuration for res_config_odbc
|
||||
;
|
||||
; Most configuration occurs in the system ODBC configuration files,
|
||||
; res_odbc.conf, and extconfig.conf. You only need this file in the
|
||||
; event that you want to influence default sorting behavior.
|
||||
;
|
||||
|
||||
[general]
|
||||
; When multiple rows are requested by realtime, res_config_odbc will add an
|
||||
; explicit ORDER BY clause to the generated SELECT statement. To prevent
|
||||
; that from occuring, set order_multi_row_results_by_initial_column to 'no'.
|
||||
;
|
||||
;order_multi_row_results_by_initial_column=no
|
|
@ -28,3 +28,9 @@ dbpass=password
|
|||
; createchar - Create char columns only
|
||||
;
|
||||
requirements=warn
|
||||
|
||||
; When multiple rows are requested by realtime, res_config_pgsql will add an
|
||||
; explicit ORDER BY clause to the generated SELECT statement. To prevent
|
||||
; that from occuring, set order_multi_row_results_by_initial_column to 'no'.
|
||||
;
|
||||
;order_multi_row_results_by_initial_column=no
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
;
|
||||
; Configuration for Shared Line Appearances (SLA).
|
||||
;
|
||||
; See http://wiki.asterisk.org or doc/AST.pdf for more information.
|
||||
; See https://docs.asterisk.org for more information.
|
||||
;
|
||||
|
||||
; ---- General Options ----------------
|
||||
|
@ -37,7 +37,7 @@
|
|||
; DAHDI channels can be directly used. IP trunks
|
||||
; require some indirect configuration which is
|
||||
; described in
|
||||
; https://wiki.asterisk.org/wiki/display/AST/SLA+Trunk+Configuration
|
||||
; https://docs.asterisk.org/Configuration/Applications/Shared-Line-Appearances-SLA/
|
||||
|
||||
;autocontext=line1 ; This supports automatic generation of the dialplan entries
|
||||
; if the autocontext option is used. Each trunk should have
|
||||
|
@ -73,7 +73,7 @@
|
|||
;type=trunk
|
||||
;device=Local/disa@line4_outbound ; A Local channel in combination with the Disa
|
||||
; application can be used to support IP trunks.
|
||||
; See https://wiki.asterisk.org/wiki/display/AST/SLA+Trunk+Configuration
|
||||
; See https://docs.asterisk.org/Configuration/Applications/Shared-Line-Appearances-SLA/
|
||||
;autocontext=line4
|
||||
; --------------------------------------
|
||||
|
||||
|
|
|
@ -76,3 +76,6 @@ test=memory
|
|||
|
||||
;[res_pjsip_publish_asterisk]
|
||||
;asterisk-publication=realtime,ps_asterisk_publications
|
||||
|
||||
;[res_stir_shaken]
|
||||
;tn=realtime,stir_tn
|
||||
|
|
|
@ -1,103 +1,459 @@
|
|||
;
|
||||
; This file is used by the res_stir_shaken module to configure parameters
|
||||
; used for STIR/SHAKEN.
|
||||
;
|
||||
; There are 2 sides to STIR/SHAKEN: attestation and verification.
|
||||
;
|
||||
; Attestation is done on outgoing calls and makes use out of the certificate
|
||||
; objects. The cert located at path will be used to sign, and the cert
|
||||
; located at public_cert_url will be placed in the Identity header to let the
|
||||
; remote side know where to download the public cert from. These 2 certs must
|
||||
; match; that is, the cert located at public_cert_url must be the public cert
|
||||
; derived from the private cert located at path.
|
||||
;
|
||||
; Verification is done on incoming calls and doesn't rely on cert objects
|
||||
; defined in this file.
|
||||
;
|
||||
; The general section applies to all STIR/SHAKEN operations. However,
|
||||
; cache_max_size, curl_timeout, and signature_timeout only apply to the
|
||||
; verification side.
|
||||
;
|
||||
; It's important to note that downloaded certificates are stored in
|
||||
; <ast_config_AST_DATA_DIR>/keys/stir_shaken, which is usually
|
||||
; /etc/asterisk/keys/stir_shaken, but may be changed depending on where your
|
||||
; config directory is.
|
||||
;
|
||||
; Visit the wiki page:
|
||||
; https://wiki.asterisk.org/wiki/display/AST/STIR+and+SHAKEN
|
||||
;
|
||||
; [general]
|
||||
;
|
||||
; File path to the certificate authority certificate
|
||||
;ca_file=/etc/asterisk/stir/ca.crt
|
||||
;
|
||||
; File path to a chain of trust
|
||||
;ca_path=/etc/asterisk/stir/ca
|
||||
;
|
||||
; Maximum size to use for caching public keys
|
||||
;cache_max_size=1000
|
||||
;
|
||||
; Maximum time (in seconds) to wait to CURL certificates
|
||||
;curl_timeout=2
|
||||
;
|
||||
; Amount of time (in seconds) a signature is valid for
|
||||
;signature_timeout=15
|
||||
;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;
|
||||
; A certificate store is used to examine, and load all certificates found in a
|
||||
; given directory. When using this type the public key URL is generated based
|
||||
; upon the filename, and variable substitution.
|
||||
;[certificates]
|
||||
;
|
||||
; type must be "store"
|
||||
;type=store
|
||||
;
|
||||
; Path to a directory containing certificates
|
||||
;path=/etc/asterisk/stir
|
||||
;
|
||||
; URL to the public certificate(s). Must contain variable '${CERTIFICATE}' used for
|
||||
; substitution. '${CERTIFICATE}' will be replaced by the names of the files located
|
||||
; at path.
|
||||
; This will be put in the Identity header when signing.
|
||||
;public_cert_url=http://mycompany.com/${CERTIFICATE}.pem
|
||||
;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;
|
||||
; Individual certificates are declared by using the certificate type.
|
||||
;[alice]
|
||||
;
|
||||
; type must be "certificate"
|
||||
;type=certificate
|
||||
;
|
||||
; File path to a certificate. This can be RSA or ECDSA, but eventually only ECDSA will be supported.
|
||||
;path=/etc/asterisk/stir/alice.pem
|
||||
;
|
||||
; URL to the public certificate. Must be of type X509 and be derived from the
|
||||
; certificate located at path.
|
||||
; This will be put in the identity header when signing.
|
||||
;public_cert_url=http://mycompany.com/alice.pem
|
||||
;
|
||||
; The caller ID number to match on
|
||||
;caller_id_number=1234567
|
||||
;
|
||||
; Must have an attestation of A, B, or C
|
||||
;attestation=C
|
||||
;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;
|
||||
; Profiles can be defined here which can be referenced by channel drivers.
|
||||
;[my_profile]
|
||||
;
|
||||
; type must be "profile"
|
||||
;type=profile
|
||||
;
|
||||
; Set stir_shaken to 'attest', 'verify', or 'on', which is the default
|
||||
;stir_shaken=on
|
||||
;
|
||||
; You can specify an ACL that will be used strictly for the Identity header when downloading public certificates
|
||||
;acllist=myacllist
|
||||
;
|
||||
; You can also do permit / deny lines if you want (also supports IPv6)
|
||||
;--
|
||||
|
||||
There are 4 object types used by the STIR/SHAKEN process...
|
||||
|
||||
The "attestation" object sets the parameters for creating an Identity
|
||||
header which attests to the ownership of the caller id on outgoing
|
||||
INVITE requests.
|
||||
|
||||
One or more "tn" objects that are used to create the outgoing Identity
|
||||
header. Each object's "id" is a specific caller-id telephone number
|
||||
and the object contains the URL to the certificate that was used to
|
||||
attest to the ownership of the caller-id, the level (A,B,C) of the
|
||||
attestation you're making, and the private key the asterisk
|
||||
attestation service will use to sign the Identity header. When
|
||||
an outgoing INVITE request is placed, the attestation service will
|
||||
look up the caller-id in the tn object list and if it's found, use
|
||||
the information in the object to create the Identity header.
|
||||
|
||||
The "verification" object sets the parameters for verification
|
||||
of the Identity header and caller id on incoming INVITE requests.
|
||||
|
||||
One or more "profile" objects that can be associated to channel
|
||||
driver endpoints (currently only chan_pjsip). Profiles can set
|
||||
whether verification, attestation, both or neither should be
|
||||
performed on requests coming in to this endpoint or requests
|
||||
going out from this endpoint. Additionally they can override
|
||||
most of the attestation and verification options to make them
|
||||
specific to an endpoint. When Asterisk loads the configs, it
|
||||
creates "effective profiles" or "eprofiles" on the fly that are
|
||||
the amalgamation of the attestation, verification and profile.
|
||||
You can see them in the CLI with "stir_shaken show eprofiles".
|
||||
|
||||
NOTE: The "tn" object can be configured to source its data from a
|
||||
realtime database by configuring sorcery.conf and extconfig.conf.
|
||||
Both of those files have examples for "stir_tn". There is also an
|
||||
Alembic script in the "config" section of contrib/ast-db-manage that
|
||||
will create the table. Since there can be only one "verification"
|
||||
or "attestation" object, and will probably be only a few "profile"
|
||||
objects, those objects aren't realtime enabled.
|
||||
|
||||
--;
|
||||
|
||||
;--
|
||||
=======================================================================
|
||||
Attestation Object Description
|
||||
=======================================================================
|
||||
The "attestation" object sets the parameters for creating an Identity
|
||||
header which attests to the ownership of the caller id on outgoing
|
||||
INVITE requests.
|
||||
|
||||
All parameters except 'global_disable" may be overridden in a "profile"
|
||||
or "tn" object.
|
||||
|
||||
Only one "attestation" object may exist.
|
||||
|
||||
Parameters:
|
||||
|
||||
-- global_disable -----------------------------------------------------
|
||||
If set, globally disables the attestation service. No Identity headers
|
||||
will be added to any outgoing INVITE requests.
|
||||
|
||||
Default: no
|
||||
|
||||
-- private_key_file ---------------------------------------------------
|
||||
The path to a file containing the private key you received from the
|
||||
issuing authority. The file must NOT be group or world readable or
|
||||
writable so make sure the user the asterisk process is running as is
|
||||
the owner.
|
||||
|
||||
Default: none
|
||||
|
||||
-- public_cert_url ----------------------------------------------------
|
||||
The URL to the certificate you received from the issueing authority.
|
||||
They may give you a URL to use or you may have to host the certificate
|
||||
yourself and provide your own URL here.
|
||||
|
||||
Default: none
|
||||
|
||||
WARNING: Make absolutely sure the file that's made public doesn't
|
||||
accidentally include the privite key as well as the certificate.
|
||||
If you set "check_tn_cert_public_url" in the "attestation" section
|
||||
above, the tn will not be loaded and a "DANGER" message will be output
|
||||
on the asterisk console if the file does contain a private key.
|
||||
|
||||
-- check_tn_cert_public_url -------------------------------------------
|
||||
Identity headers in outgoing requests must contain a URL that points
|
||||
to the certificate used to sign the header. Setting this parameter
|
||||
tells Asterisk to actually try to retrieve the certificates indicated
|
||||
by "public_cert_url" parameters and fail loading that tn if the cert
|
||||
can't be retrieved or if its 'Not Valid Before" -> 'Not Valid After"
|
||||
date range doesn't include today. This is a network intensive process
|
||||
so use with caution.
|
||||
|
||||
Default: no
|
||||
|
||||
-- attest_level -------------------------------------------------------
|
||||
The level of the attestation you're making.
|
||||
One of "A", "B", "C"
|
||||
|
||||
Default: none
|
||||
|
||||
-- send_mky -----------------------------------------------------------
|
||||
If set and an outgoing call uses DTLS, an "mky" Media Key grant will
|
||||
be added to the Identity header. Although RFC8224/8225 require this,
|
||||
not many implementations support it so a remote verification service
|
||||
may fail to verify the signature.
|
||||
|
||||
Default: no
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
Example "attestation" object:
|
||||
--;
|
||||
|
||||
;[attestation]
|
||||
;global_disable = no
|
||||
;private_key_path = /var/lib/asterisk/keys/stir_shaken/tns/multi-tns-key.pem
|
||||
;public_cert_url = https://example.com/tncerts/multi-tns-cert.pem
|
||||
;attest_level = C
|
||||
|
||||
;--
|
||||
=======================================================================
|
||||
TN Object Description
|
||||
=======================================================================
|
||||
Each "tn" object contains the parameters needed to create the Identity
|
||||
header used to attest to the ownership of the caller-id on outgoing
|
||||
requests. When an outgoing INVITE request is placed, the attestation
|
||||
service will look up the caller-id in this list and if it's found, use
|
||||
the information in the object to create the Identity header.
|
||||
The private key and certificate needed to sign the Identity header are
|
||||
usually provided to you by the telephone number issuing authority along
|
||||
with their certificate authority certificate. You should give the CA
|
||||
certificate to any recipients who expect to receive calls from you
|
||||
although this has probably already been done by the issuing authority.
|
||||
|
||||
The "id" of this object MUST be a canonicalized telephone number which
|
||||
starts with a country code. The only valid characters are the numbers
|
||||
0-9, '#' and '*'.
|
||||
|
||||
Parameters:
|
||||
|
||||
-- type (required) ----------------------------------------------------
|
||||
Must be set to "tn"
|
||||
|
||||
Default: none
|
||||
|
||||
-- private_key_file ---------------------------------------------------
|
||||
The path to a file containing the private key you received from the
|
||||
issuing authority. The file must NOT be group or world readable or
|
||||
writable so make sure the user the asterisk process is running as is
|
||||
the owner.
|
||||
|
||||
Default: private_key_file from the profile or attestation objects.
|
||||
|
||||
-- public_cert_url ----------------------------------------------------
|
||||
The URL to the certificate you received from the issueing authority.
|
||||
They may give you a URL to use or you may have to host the certificate
|
||||
yourself and provide your own URL here.
|
||||
|
||||
Default: public_cert_url from the profile or attestation objects.
|
||||
|
||||
WARNING: Make absolutely sure the file that's made public doesn't
|
||||
accidentally include the privite key as well as the certificate.
|
||||
If you set "check_tn_cert_public_url" in the "attestation" section
|
||||
above, the tn will not be loaded and a "DANGER" message will be output
|
||||
on the asterisk console if the file does contain a private key.
|
||||
|
||||
-- attest_level -------------------------------------------------------
|
||||
The level of the attestation you're making.
|
||||
One of "A", "B", "C"
|
||||
|
||||
Default: attest_level from the profile or attestation objects.
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
Example "tn" object:
|
||||
--;
|
||||
|
||||
;[18005551515]
|
||||
;type = tn
|
||||
;private_key_path = /var/lib/asterisk/keys/stir_shaken/tns/18005551515-key.pem
|
||||
;public_cert_url = https://example.com/tncerts/18005551515-cert.pem
|
||||
;attest_level = C
|
||||
|
||||
;--
|
||||
=======================================================================
|
||||
Verification Object Description
|
||||
=======================================================================
|
||||
The "verification" object sets the parameters for verification
|
||||
of the Identity header on incoming INVITE requests.
|
||||
|
||||
All parameters except 'global_disable" may be overridden in a "profile"
|
||||
object.
|
||||
|
||||
Only one "verification" object may exist.
|
||||
|
||||
Parameters:
|
||||
|
||||
-- global_disable -----------------------------------------------------
|
||||
If set, globally disables the verification service.
|
||||
|
||||
Default: no
|
||||
|
||||
-- load_system_certs---------------------------------------------------
|
||||
If set, loads the system Certificate Authority certificates
|
||||
(usually located in /etc/pki/CA) into the trust store used to
|
||||
validate the certificates in incoming requests. This is not
|
||||
normally required as service providers will usually provide their
|
||||
CA certififcate to you separately.
|
||||
|
||||
Default: no
|
||||
|
||||
-- ca_file -----------------------------------------------------------
|
||||
Path to a single file containing a CA certificate or certificate chain
|
||||
to be used to validate the certificates in incoming requests.
|
||||
|
||||
Default: none
|
||||
|
||||
-- ca_path -----------------------------------------------------------
|
||||
Path to a directory containing one or more CA certificates to be used
|
||||
to validate the certificates in incoming requests. The files in that
|
||||
directory must contain only one certificate each and the directory
|
||||
must be hashed using the OpenSSL 'c_rehash' utility.
|
||||
|
||||
Default: none
|
||||
|
||||
NOTE: Both ca_file and ca_path can be specified but at least one
|
||||
MUST be.
|
||||
|
||||
-- crl_file -----------------------------------------------------------
|
||||
Path to a single file containing a CA certificate revocation list
|
||||
to be used to validate the certificates in incoming requests.
|
||||
|
||||
Default: none
|
||||
|
||||
-- crl_path -----------------------------------------------------------
|
||||
Path to a directory containing one or more CA certificate revocation
|
||||
lists to be used to validate the certificates in incoming requests.
|
||||
The files in that directory must contain only one certificate each and
|
||||
the directory must be hashed using the OpenSSL 'c_rehash' utility.
|
||||
|
||||
Default: none
|
||||
|
||||
NOTE: Neither crl_file nor crl_path are required.
|
||||
|
||||
-- cert_cache_dir -----------------------------------------------------
|
||||
Incoming Identity headers will have a URL pointing to the certificate
|
||||
used to sign the header. To prevent us from having to retrieve the
|
||||
certificate for every request, we maintain a cache of them in the
|
||||
'cert_cache_dir' specified. The directory will be checked for
|
||||
existence and writability at startup.
|
||||
|
||||
Default: <astvarlibdir>/keys/stir_shaken/cache
|
||||
|
||||
-- curl_timeout -------------------------------------------------------
|
||||
The number of seconds we'll wait for a response when trying to retrieve
|
||||
the certificate specified in the incoming Identity header's "x5u"
|
||||
parameter.
|
||||
|
||||
Default: 2
|
||||
|
||||
-- max_cache_entry_age ------------------------------------------------
|
||||
Maximum age in seconds a certificate in the cache can reach before
|
||||
re-retrieving it.
|
||||
|
||||
Default: 86400 (24 hours per ATIS-1000074)
|
||||
|
||||
NOTE: If, when retrieving the URL specified by the "x5u" parameter,
|
||||
we receive a recognized caching directive in the HTTP response AND that
|
||||
directive indicates caching for MORE than the value set here, we'll use
|
||||
that time for the max_cache_entry_age.
|
||||
|
||||
-- max_cache_size -----------------------------------------------------
|
||||
Maximum number of entries the cache can hold.
|
||||
Not presently implemented.
|
||||
|
||||
-- max_iat_age --------------------------------------------------------
|
||||
The "iat" parameter in the Identity header indicates the time the
|
||||
sender actually created their attestation. If that is older than the
|
||||
current time by the number of seconds set here, the request will be
|
||||
considered "failed".
|
||||
|
||||
Default: 15
|
||||
|
||||
-- max_date_header_age ------------------------------------------------
|
||||
The sender MUST also send a SIP Date header in their request. If we
|
||||
receive one that is older than the current time by the number of seconds
|
||||
set here, the request will be considered "failed".
|
||||
|
||||
Default: 15
|
||||
|
||||
-- failure_action -----------------------------------------------------
|
||||
Indicates what will happen to requests that have failed verification.
|
||||
Must be one of:
|
||||
- continue -
|
||||
Continue processing the request. You can use the STIR_SHAKEN
|
||||
dialplan function to determine whether the request passed or failed
|
||||
verification and take the action you deem appropriate.
|
||||
|
||||
- reject_request -
|
||||
Reject the request immediately using the SIP response codes
|
||||
defined by RFC8224.
|
||||
|
||||
- continue_return_reason -
|
||||
Continue processing the request but, per RFC8224, send a SIP Reason
|
||||
header back to the originator in the next provisional response
|
||||
indicating the issue according to RFC8224. You can use the
|
||||
STIR_SHAKEN dialplan function to determine whether the request
|
||||
passed or failed verification and take the action you deem
|
||||
appropriate.
|
||||
|
||||
Default: continue
|
||||
|
||||
NOTE: If you select "continue" or "continue_return_reason", and,
|
||||
based on the results from the STIR_SHAKEN function, you determine you
|
||||
want to terminate the call, you can use the PJSIPHangup() dialplan
|
||||
application to reject the call using a STIR/SHAKEN-specific SIP
|
||||
response code.
|
||||
|
||||
-- use_rfc9410_responses ----------------------------------------------
|
||||
If set, when sending Reason headers back to originators, the protocol
|
||||
header parameter will be set to "STIR" rather than "SIP". This is a
|
||||
new protocol defined in RFC9410 and may not be supported by all
|
||||
participants.
|
||||
|
||||
Default: no
|
||||
|
||||
-- relax_x5u_port_scheme_restrictions ---------------------------------
|
||||
If set, the port and scheme restrictions imposed by ATIS-1000074
|
||||
section 5.3.1 that require the scheme to be "https" and the port to
|
||||
be 443 or 8443 are relaxed. This will allow schemes like "http"
|
||||
and ports other than the two mentioned to appear in x5u URLs received
|
||||
in Identity headers.
|
||||
|
||||
Default: no
|
||||
|
||||
CAUTION: Setting this parameter could have serious security
|
||||
implications and should only be use for testing.
|
||||
|
||||
-- relax_x5u_path_restrictions ----------------------------------------
|
||||
If set, the path restrictions imposed by ATIS-1000074 section 5.3.1
|
||||
that require the x5u URL to be rejected if it contains a query string,
|
||||
path parameters, fragment identifier or user/password are relaxed.
|
||||
|
||||
Default: no
|
||||
|
||||
CAUTION: Setting this parameter could have serious security
|
||||
implications and should only be use for testing.
|
||||
|
||||
-- x5u_permit/x5u_deny ------------------------------------------------
|
||||
When set, the IP address of the host in a received Identity header x5u
|
||||
URL is checked against the acl created by this list of permit/deny
|
||||
parameters. If the check fails, the x5u URL will be considered invalid
|
||||
and verification will fail. This can prevent an attacker from sending
|
||||
you a request pretending to be a known originator with a mailcious
|
||||
certificate URL. (Server-side request forgery (SSRF)).
|
||||
See acl.conf.sample to see examples of how to specify the permit/deny
|
||||
parameters.
|
||||
|
||||
Default: Deny all "Special-Purpose" IP addresses described in RFC 6890.
|
||||
This includes the loopback addresses 127.0.0.0/8, private use networks such
|
||||
as 10.0.0/8, 172.16.0.0/12 and 192.168.0.0/16, and the link local network
|
||||
169.254.0.0/16 among others.
|
||||
|
||||
CAUTION: Setting this parameter could have serious security
|
||||
implications and should only be use for testing.
|
||||
|
||||
-- x5u_acl ------------------------------------------------------------
|
||||
Rather than providing individual permit/deny parameters, you can set
|
||||
the acllist parameter to an acl list predefined in acl.conf.
|
||||
|
||||
Default: none
|
||||
|
||||
CAUTION: Setting this parameter could have serious security
|
||||
implications and should only be use for testing.
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
Example "verification" object:
|
||||
--;
|
||||
|
||||
;[verification]
|
||||
;global_disable = yes
|
||||
;load_system_certs = no
|
||||
;ca_path = /var/lib/asterisk/keys/stir_shaken/verification_ca
|
||||
;cert_cache_dir = /var/lib/asterisk/keys/stir_shaken/verification_cache
|
||||
;failure_action = reject_request
|
||||
;curl_timeout=5
|
||||
;max_iat_age=60
|
||||
;max_date_header_age=60
|
||||
;max_cache_entry_age = 300
|
||||
; For internal testing
|
||||
;x5u_deny=0.0.0.0/0.0.0.0
|
||||
;x5u_permit=127.0.0.0/8
|
||||
;x5u_permit=192.168.100.0/24
|
||||
;relax_x5u_port_scheme_restrictions = yes
|
||||
;relax_x5u_path_restrictions = yes
|
||||
|
||||
;--
|
||||
=======================================================================
|
||||
Profile Object Description
|
||||
=======================================================================
|
||||
A "profile" object can be associated to channel driver endpoint
|
||||
(currently only chan_pjsip) and can set verification and attestation
|
||||
parameters specific to endpoints using this profile. If you have
|
||||
multiple upstream providers, this is the place to set parameters
|
||||
specific to them.
|
||||
|
||||
The "id" of this object is arbitrary and you'd specify it in the
|
||||
"stir_shaken_profile" parameter of the endpoint.
|
||||
|
||||
Parameters:
|
||||
|
||||
-- type (required) ----------------------------------------------------
|
||||
Must be set to "profile"
|
||||
|
||||
Default: none
|
||||
|
||||
-- endpoint_behhavior--------------------------------------------------
|
||||
Actions to be performed for endpoints referencing this profile.
|
||||
Must be one of:
|
||||
- off -
|
||||
Don't do any STIR/SHAKEN processing.
|
||||
- attest -
|
||||
Attest on outgoing calls.
|
||||
- verify
|
||||
Verify incoming calls.
|
||||
- on -
|
||||
Attest outgoing calls and verify incoming calls.
|
||||
Default: off
|
||||
|
||||
All of the "verification" parameters defined above can be set on a profile
|
||||
with the exception of 'global_disable'.
|
||||
|
||||
All of the "attestation" parameters defined above can be set on a profile
|
||||
with the exception of 'global_disable'.
|
||||
|
||||
When Asterisk loads the configs, it creates "effective profiles" or
|
||||
"eprofiles" on the fly that are the amalgamation of the attestation,
|
||||
verification and profile. You can see them in the CLI with
|
||||
"stir_shaken show eprofiles".
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
Example "profile" object:
|
||||
--;
|
||||
|
||||
;[myprofile]
|
||||
;type = profile
|
||||
;endpoint_behavior = verify
|
||||
;failure_action = continue_return_reason
|
||||
;x5u_acl = myacllist
|
||||
|
||||
;In pjsip.conf...
|
||||
;[myendpoint]
|
||||
;type = endpoint
|
||||
;stir_shaken_profile = myprofile
|
||||
|
||||
;In acl.conf...
|
||||
;[myacllist]
|
||||
;permit=0.0.0.0/0.0.0.0
|
||||
;deny=127.0.0.1
|
||||
;deny=10.24.20.171
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
[general]
|
||||
port=5000 ; UDP port
|
||||
;
|
||||
; See https://wiki.asterisk.org/wiki/display/AST/IP+Quality+of+Service for a description of these parameters.
|
||||
; See https://docs.asterisk.org/Configuration/Channel-Drivers/IP-Quality-of-Service for a description of these parameters.
|
||||
;tos=cs3 ; Sets TOS for signaling packets.
|
||||
;tos_audio=ef ; Sets TOS for RTP audio packets.
|
||||
;cos=3 ; Sets 802.1p priority for signaling packets.
|
||||
|
|
|
@ -293,7 +293,8 @@ sendvoicemail=yes ; Allow the user to compose and send a voicemail while inside
|
|||
; if not listed, calling the sender back will not be permitted
|
||||
; exitcontext=fromvm ; Context to go to on user exit such as * or 0
|
||||
; The default is the current context.
|
||||
; review=yes ; Allow sender to review/rerecord their message before saving it [OFF by default
|
||||
; review=yes ; Allow sender to review/rerecord their message before saving it [OFF by default]
|
||||
; leaveurgent=yes ; Allow senders to leave messages that are marked as 'Urgent' [ON by default]
|
||||
; operator=yes ; Allow sender to hit 0 before/after/during leaving a voicemail to
|
||||
; reach an operator. This option REQUIRES an 'o' extension in the
|
||||
; same context (or in exitcontext, if set), as that is where the
|
||||
|
|
25
configure.ac
25
configure.ac
|
@ -1,6 +1,6 @@
|
|||
AC_PREREQ(2.60a)
|
||||
|
||||
AC_INIT([asterisk], [master], [https://github.com/asterisk/asterisk/issues])
|
||||
AC_INIT([asterisk], [21], [https://github.com/asterisk/asterisk/issues])
|
||||
|
||||
# cross-compile macros
|
||||
AC_CANONICAL_BUILD
|
||||
|
@ -463,6 +463,15 @@ if test "${with_pjproject}" = "no" || test "${with_pjproject}" = "n" ; then
|
|||
PJPROJECT_BUNDLED=no
|
||||
fi
|
||||
|
||||
LIBJWT_BUNDLED=no
|
||||
AC_ARG_WITH([libjwt-bundled],
|
||||
[AS_HELP_STRING([--with-libjwt-bundled],
|
||||
[Use bundled libjwt library])],
|
||||
[case "${withval}" in
|
||||
y|ye|yes) LIBJWT_BUNDLED=yes ;;
|
||||
*) LIBJWT_BUNDLED=no ;;
|
||||
esac])
|
||||
|
||||
#
|
||||
# OpenSSL stuff has to be done here because we want to pass
|
||||
# any resulting CFLAGS and LDFLAGS to the bundled pjproject
|
||||
|
@ -553,6 +562,7 @@ AST_EXT_LIB_SETUP([LDAP], [OpenLDAP], [ldap])
|
|||
AST_LIBCURL_CHECK_CONFIG([], [7.10.1])
|
||||
AST_EXT_LIB_SETUP([LIBEDIT], [NetBSD Editline library], [libedit])
|
||||
AST_EXT_LIB_SETUP_OPTIONAL([LIBEDIT_IS_UNICODE], [Libedit compiled for unicode], [LIBEDIT], [libedit])
|
||||
AST_EXT_LIB_SETUP([LIBJWT], [LIBJWT], [libjwt])
|
||||
AST_EXT_LIB_SETUP([LIBXML2], [LibXML2], [libxml2])
|
||||
AST_EXT_LIB_SETUP([LIBXSLT], [LibXSLT], [libxslt])
|
||||
AST_EXT_LIB_SETUP_OPTIONAL([LIBXSLT_CLEANUP], [LibXSLT Library Cleanup Function], [LIBXSLT], [libxslt])
|
||||
|
@ -736,6 +746,14 @@ else
|
|||
PBX_JANSSON=1
|
||||
fi
|
||||
|
||||
source ./third-party/versions.mak
|
||||
# Find required JWT support if bundled is not enabled.
|
||||
if test "$LIBJWT_BUNDLED" = "no" ; then
|
||||
AST_PKG_CONFIG_CHECK([LIBJWT], [libjwt >= $LIBJWT_VERSION])
|
||||
else
|
||||
PBX_LIBJWT=1
|
||||
fi
|
||||
|
||||
# See if clock_gettime is in librt
|
||||
AST_EXT_LIB_CHECK([RT], [rt], [clock_gettime], [])
|
||||
|
||||
|
@ -1154,9 +1172,6 @@ AC_LINK_IFELSE(
|
|||
#)
|
||||
#fi
|
||||
|
||||
# for FreeBSD thr_self
|
||||
AC_CHECK_HEADERS([sys/thr.h])
|
||||
|
||||
AC_MSG_CHECKING(for compiler sync operations)
|
||||
AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM([], [int foo1; int foo2 = __sync_fetch_and_add(&foo1, 1);])],
|
||||
|
@ -1714,7 +1729,7 @@ if test "${USE_ILBC}" != "no"; then
|
|||
ILBC_INTERNAL="no"
|
||||
fi
|
||||
if test "${ILBC_SYSTEM}" = "yes"; then
|
||||
AST_PKG_CONFIG_CHECK(ILBC, libilbc)
|
||||
AST_PKG_CONFIG_CHECK(ILBC, libilbc < 3)
|
||||
if test "$PBX_ILBC" = "1"; then
|
||||
ILBC_INTERNAL="no"
|
||||
fi
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
*.ini
|
|
@ -0,0 +1,22 @@
|
|||
"""add user-agent-header to ps_registrations
|
||||
|
||||
Revision ID: 24c12d8e9014
|
||||
Revises: 37a5332640e2
|
||||
Create Date: 2024-01-05 14:14:47.510917
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '24c12d8e9014'
|
||||
down_revision = '37a5332640e2'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column('ps_registrations', sa.Column('user_agent', sa.String(255)))
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_column('ps_registrations', 'user_agent')
|
|
@ -0,0 +1,58 @@
|
|||
"""update pjsip tls method list
|
||||
|
||||
Revision ID: 37a5332640e2
|
||||
Revises: dac2b4c328b8
|
||||
Create Date: 2023-11-14 18:02:18.857452
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '37a5332640e2'
|
||||
down_revision = 'dac2b4c328b8'
|
||||
|
||||
from alembic import op
|
||||
from sqlalchemy.dialects.postgresql import ENUM
|
||||
import sqlalchemy as sa
|
||||
|
||||
PJSIP_TRANSPORT_METHOD_OLD_NAME = 'pjsip_transport_method_values'
|
||||
PJSIP_TRANSPORT_METHOD_NEW_NAME = 'pjsip_transport_method_values_v2'
|
||||
|
||||
PJSIP_TRANSPORT_METHOD_OLD_VALUES = ['default', 'unspecified', 'tlsv1', 'sslv2',
|
||||
'sslv3', 'sslv23']
|
||||
PJSIP_TRANSPORT_METHOD_NEW_VALUES = ['default', 'unspecified',
|
||||
'tlsv1', 'tlsv1_1', 'tlsv1_2', 'tlsv1_3',
|
||||
'sslv2', 'sslv23', 'sslv3']
|
||||
|
||||
PJSIP_TRANSPORT_METHOD_OLD_TYPE = sa.Enum(*PJSIP_TRANSPORT_METHOD_OLD_VALUES,
|
||||
name=PJSIP_TRANSPORT_METHOD_OLD_NAME)
|
||||
PJSIP_TRANSPORT_METHOD_NEW_TYPE = sa.Enum(*PJSIP_TRANSPORT_METHOD_NEW_VALUES,
|
||||
name=PJSIP_TRANSPORT_METHOD_NEW_NAME)
|
||||
def upgrade():
|
||||
if op.get_context().bind.dialect.name == 'postgresql':
|
||||
enum = PJSIP_TRANSPORT_METHOD_NEW_TYPE
|
||||
enum.create(op.get_bind(), checkfirst=False)
|
||||
|
||||
op.alter_column('ps_transports', 'method',
|
||||
type_=PJSIP_TRANSPORT_METHOD_NEW_TYPE,
|
||||
existing_type=PJSIP_TRANSPORT_METHOD_OLD_TYPE,
|
||||
postgresql_using='method::text::' + PJSIP_TRANSPORT_METHOD_NEW_NAME)
|
||||
|
||||
if op.get_context().bind.dialect.name == 'postgresql':
|
||||
ENUM(name=PJSIP_TRANSPORT_METHOD_OLD_NAME).drop(op.get_bind(), checkfirst=False)
|
||||
|
||||
def downgrade():
|
||||
# First we need to ensure that columns are not using the enum values
|
||||
# that are going away.
|
||||
op.execute("UPDATE ps_transports SET method = 'tlsv1' WHERE method IN ('tlsv1_1', 'tlsv1_2', 'tlsv1_3')")
|
||||
|
||||
if op.get_context().bind.dialect.name == 'postgresql':
|
||||
enum = PJSIP_TRANSPORT_METHOD_OLD_TYPE
|
||||
enum.create(op.get_bind(), checkfirst=False)
|
||||
|
||||
op.alter_column('ps_transports', 'method',
|
||||
type_=PJSIP_TRANSPORT_METHOD_OLD_TYPE,
|
||||
existing_type=PJSIP_TRANSPORT_METHOD_NEW_TYPE,
|
||||
postgresql_using='method::text::' + PJSIP_TRANSPORT_METHOD_OLD_NAME)
|
||||
|
||||
if op.get_context().bind.dialect.name == 'postgresql':
|
||||
ENUM(name=PJSIP_TRANSPORT_METHOD_NEW_NAME).drop(op.get_bind(), checkfirst=False)
|
|
@ -30,6 +30,7 @@ down_revision = None
|
|||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.sql import quoted_name
|
||||
from sqlalchemy.dialects.postgresql import ENUM
|
||||
|
||||
YESNO_VALUES = ['yes', 'no']
|
||||
|
@ -123,7 +124,7 @@ def upgrade():
|
|||
sa.Column('regexten', sa.String(40)),
|
||||
sa.Column('fromdomain', sa.String(40)),
|
||||
sa.Column('fromuser', sa.String(40)),
|
||||
sa.Column('qualify', sa.String(40)),
|
||||
sa.Column(quoted_name('qualify', True), sa.String(40)),
|
||||
sa.Column('defaultip', sa.String(45)),
|
||||
sa.Column('rtptimeout', sa.Integer),
|
||||
sa.Column('rtpholdtimeout', sa.Integer),
|
||||
|
@ -220,7 +221,7 @@ def upgrade():
|
|||
sa.Column('disallow', sa.String(200)),
|
||||
sa.Column('allow', sa.String(200)),
|
||||
sa.Column('codecpriority', sa.String(40)),
|
||||
sa.Column('qualify', sa.String(10)),
|
||||
sa.Column(quoted_name('qualify', True), sa.String(10)),
|
||||
sa.Column('qualifysmoothing',
|
||||
sa.Enum(*YESNO_VALUES, name='yes_no_values')),
|
||||
sa.Column('qualifyfreqok', sa.String(10)),
|
||||
|
|
|
@ -33,9 +33,9 @@ def upgrade():
|
|||
enum = ENUM(*NEW_ENUM, name='pjsip_100rel_values_v2')
|
||||
enum.create(op.get_bind(), checkfirst=False)
|
||||
|
||||
op.execute('ALTER TABLE ps_endpoints ALTER COLUMN 100rel TYPE'
|
||||
op.execute('ALTER TABLE ps_endpoints ALTER COLUMN "100rel" TYPE'
|
||||
' pjsip_100rel_values_v2 USING'
|
||||
' 100rel::text::pjsip_100rel_values_v2')
|
||||
' "100rel"::text::pjsip_100rel_values_v2')
|
||||
|
||||
ENUM(name="pjsip_100rel_values").drop(op.get_bind(), checkfirst=False)
|
||||
|
||||
|
@ -50,8 +50,8 @@ def downgrade():
|
|||
enum = ENUM(*OLD_ENUM, name='pjsip_100rel_values')
|
||||
enum.create(op.get_bind(), checkfirst=False)
|
||||
|
||||
op.execute('ALTER TABLE ps_endpoints ALTER COLUMN 100rel TYPE'
|
||||
op.execute('ALTER TABLE ps_endpoints ALTER COLUMN "100rel" TYPE'
|
||||
' pjsip_100rel_values USING'
|
||||
' 100rel::text::pjsip_100rel_values')
|
||||
' "100rel"::text::pjsip_100rel_values')
|
||||
|
||||
ENUM(name="pjsip_100rel_values_v2").drop(op.get_bind(), checkfirst=False)
|
||||
|
|
|
@ -0,0 +1,139 @@
|
|||
"""more permission boolean columns
|
||||
|
||||
Revision ID: 74dc751dfe8e
|
||||
Revises: bd335bae5d33
|
||||
Create Date: 2024-02-27 15:31:09.458313
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '74dc751dfe8e'
|
||||
down_revision = 'bd335bae5d33'
|
||||
|
||||
import itertools
|
||||
import operator
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import case, cast, or_, text
|
||||
from sqlalchemy.dialects.postgresql import ENUM
|
||||
from sqlalchemy.sql import table, column
|
||||
|
||||
COLUMNS = [ ('ps_aors', 'authenticate_qualify'),
|
||||
('ps_aors', 'remove_existing'),
|
||||
('ps_aors', 'support_path'),
|
||||
('ps_asterisk_publications', 'device_state'),
|
||||
('ps_asterisk_publications', 'mailbox_state'),
|
||||
('ps_contacts', 'authenticate_qualify'),
|
||||
('ps_contacts', 'prune_on_boot'),
|
||||
('ps_endpoint_id_ips', 'srv_lookups'),
|
||||
('ps_endpoints', 'accept_multiple_sdp_answers'),
|
||||
('ps_endpoints', 'aggregate_mwi'),
|
||||
('ps_endpoints', 'allow_overlap'),
|
||||
('ps_endpoints', 'allow_subscribe'),
|
||||
('ps_endpoints', 'allow_transfer'),
|
||||
('ps_endpoints', 'asymmetric_rtp_codec'),
|
||||
('ps_endpoints', 'bind_rtp_to_media_address'),
|
||||
('ps_endpoints', 'bundle'),
|
||||
('ps_endpoints', 'direct_media'),
|
||||
('ps_endpoints', 'disable_direct_media_on_nat'),
|
||||
('ps_endpoints', 'dtls_auto_generate_cert'),
|
||||
('ps_endpoints', 'fax_detect'),
|
||||
('ps_endpoints', 'follow_early_media_fork'),
|
||||
('ps_endpoints', 'force_avp'),
|
||||
('ps_endpoints', 'force_rport'),
|
||||
('ps_endpoints', 'g726_non_standard'),
|
||||
('ps_endpoints', 'ice_support'),
|
||||
('ps_endpoints', 'inband_progress'),
|
||||
('ps_endpoints', 'media_encryption_optimistic'),
|
||||
('ps_endpoints', 'media_use_received_transport'),
|
||||
('ps_endpoints', 'moh_passthrough'),
|
||||
('ps_endpoints', 'notify_early_inuse_ringing'),
|
||||
('ps_endpoints', 'one_touch_recording'),
|
||||
('ps_endpoints', 'preferred_codec_only'),
|
||||
('ps_endpoints', 'refer_blind_progress'),
|
||||
('ps_endpoints', 'rewrite_contact'),
|
||||
('ps_endpoints', 'rpid_immediate'),
|
||||
('ps_endpoints', 'rtcp_mux'),
|
||||
('ps_endpoints', 'rtp_ipv6'),
|
||||
('ps_endpoints', 'rtp_symmetric'),
|
||||
('ps_endpoints', 'send_diversion'),
|
||||
('ps_endpoints', 'send_pai'),
|
||||
('ps_endpoints', 'send_rpid'),
|
||||
('ps_endpoints', 'srtp_tag_32'),
|
||||
('ps_endpoints', 'suppress_q850_reason_headers'),
|
||||
('ps_endpoints', 't38_udptl'),
|
||||
('ps_endpoints', 't38_udptl_ipv6'),
|
||||
('ps_endpoints', 't38_udptl_nat'),
|
||||
('ps_endpoints', 'trust_id_inbound'),
|
||||
('ps_endpoints', 'trust_id_outbound'),
|
||||
('ps_endpoints', 'use_avpf'),
|
||||
('ps_endpoints', 'use_ptime'),
|
||||
('ps_endpoints', 'user_eq_phone'),
|
||||
('ps_endpoints', 'webrtc'),
|
||||
('ps_globals', 'disable_multi_domain'),
|
||||
('ps_globals', 'ignore_uri_user_options'),
|
||||
('ps_globals', 'mwi_disable_initial_unsolicited'),
|
||||
('ps_outbound_publishes', 'multi_user'),
|
||||
('ps_registrations', 'auth_rejection_permanent'),
|
||||
('ps_registrations', 'line'),
|
||||
('ps_registrations', 'support_path'),
|
||||
('ps_resource_list', 'full_state'),
|
||||
('ps_subscription_persistence', 'prune_on_boot'),
|
||||
('ps_systems', 'accept_multiple_sdp_answers'),
|
||||
('ps_systems', 'compact_headers'),
|
||||
('ps_systems', 'disable_tcp_switch'),
|
||||
('ps_systems', 'follow_early_media_fork'),
|
||||
('ps_transports', 'allow_reload'),
|
||||
('ps_transports', 'allow_wildcard_certs'),
|
||||
('ps_transports', 'require_client_cert'),
|
||||
('ps_transports', 'symmetric_transport'),
|
||||
('ps_transports', 'verify_client'),
|
||||
('ps_transports', 'verify_server') ]
|
||||
|
||||
YESNO_NAME = 'yesno_values'
|
||||
YESNO_VALUES = ['yes', 'no']
|
||||
|
||||
AST_BOOL_NAME = 'ast_bool_values'
|
||||
AST_BOOL_VALUES = [ '0', '1',
|
||||
'off', 'on',
|
||||
'false', 'true',
|
||||
'no', 'yes' ]
|
||||
|
||||
yesno_values = ENUM(*YESNO_VALUES, name=YESNO_NAME, create_type=False)
|
||||
ast_bool_values = ENUM(*AST_BOOL_VALUES, name=AST_BOOL_NAME, create_type=False)
|
||||
|
||||
def upgrade():
|
||||
for table_name, column_list in itertools.groupby(COLUMNS, operator.itemgetter(0)):
|
||||
with op.batch_alter_table(table_name) as batch_op:
|
||||
for _, column_name in column_list:
|
||||
batch_op.alter_column(column_name,
|
||||
type_=ast_bool_values,
|
||||
existing_type=yesno_values,
|
||||
postgresql_using='"{}"::text::{}'.format(column_name, AST_BOOL_NAME))
|
||||
|
||||
def downgrade():
|
||||
for table_name, column_list in itertools.groupby(COLUMNS, operator.itemgetter(0)):
|
||||
subject = table(table_name)
|
||||
values_exprs = {}
|
||||
for _, column_name in column_list:
|
||||
subject.append_column(column(column_name))
|
||||
values_exprs[column_name] = cast(
|
||||
case((or_(subject.c[column_name] == text("'yes'"),
|
||||
subject.c[column_name] == text("'1'"),
|
||||
subject.c[column_name] == text("'on'"),
|
||||
subject.c[column_name] == text("'true'")), text("'yes'")),
|
||||
else_=text("'no'")),
|
||||
ast_bool_values)
|
||||
|
||||
op.execute(
|
||||
subject.update().values(values_exprs)
|
||||
)
|
||||
|
||||
for table_name, column_list in itertools.groupby(COLUMNS, operator.itemgetter(0)):
|
||||
with op.batch_alter_table(table_name) as batch_op:
|
||||
for _, column_name in column_list:
|
||||
batch_op.alter_column(column_name,
|
||||
type_=yesno_values,
|
||||
existing_type=ast_bool_values,
|
||||
postgresql_using='"{}"::text::{}'.format(column_name, YESNO_NAME))
|
|
@ -0,0 +1,35 @@
|
|||
"""Create STIR/SHAKEN TN table
|
||||
|
||||
Revision ID: bd335bae5d33
|
||||
Revises: 24c12d8e9014
|
||||
Create Date: 2024-01-09 12:17:47.353533
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'bd335bae5d33'
|
||||
down_revision = '24c12d8e9014'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects.postgresql import ENUM
|
||||
|
||||
AST_BOOL_NAME = 'ast_bool_values'
|
||||
AST_BOOL_VALUES = [ '0', '1',
|
||||
'off', 'on',
|
||||
'false', 'true',
|
||||
'no', 'yes' ]
|
||||
|
||||
def upgrade():
|
||||
ast_bool_values = ENUM(*AST_BOOL_VALUES, name=AST_BOOL_NAME, create_type=False)
|
||||
op.create_table(
|
||||
'stir_tn',
|
||||
sa.Column('id', sa.String(80), nullable=False, primary_key=True),
|
||||
sa.Column('private_key_file', sa.String(1024), nullable=True),
|
||||
sa.Column('public_cert_url', sa.String(1024), nullable=True),
|
||||
sa.Column('attest_level', sa.String(1), nullable=True),
|
||||
sa.Column('send_mky', ast_bool_values)
|
||||
)
|
||||
|
||||
def downgrade():
|
||||
op.drop_table('stir_tn')
|
|
@ -0,0 +1,83 @@
|
|||
"""increase pjsip id length
|
||||
|
||||
Revision ID: dac2b4c328b8
|
||||
Revises: f5b0e7427449
|
||||
Create Date: 2023-09-23 02:15:24.270526
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'dac2b4c328b8'
|
||||
down_revision = 'f5b0e7427449'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.alter_column('ps_aors', 'id', type_=sa.String(255))
|
||||
op.alter_column('ps_aors', 'outbound_proxy', type_=sa.String(255))
|
||||
|
||||
op.alter_column('ps_auths', 'id', type_=sa.String(255))
|
||||
op.alter_column('ps_auths', 'realm', type_=sa.String(255))
|
||||
|
||||
op.alter_column('ps_contacts', 'outbound_proxy', type_=sa.String(255))
|
||||
op.alter_column('ps_contacts', 'endpoint', type_=sa.String(255))
|
||||
|
||||
op.alter_column('ps_domain_aliases', 'id', type_=sa.String(255))
|
||||
op.alter_column('ps_domain_aliases', 'domain', type_=sa.String(255))
|
||||
|
||||
op.alter_column('ps_endpoint_id_ips', 'id', type_=sa.String(255))
|
||||
op.alter_column('ps_endpoint_id_ips', 'endpoint', type_=sa.String(255))
|
||||
|
||||
op.alter_column('ps_endpoints', 'id', type_=sa.String(255))
|
||||
op.alter_column('ps_endpoints', 'aors', type_=sa.String(2048))
|
||||
op.alter_column('ps_endpoints', 'auth', type_=sa.String(255))
|
||||
op.alter_column('ps_endpoints', 'outbound_auth', type_=sa.String(255))
|
||||
op.alter_column('ps_endpoints', 'outbound_proxy', type_=sa.String(255))
|
||||
|
||||
op.alter_column('ps_inbound_publications', 'id', type_=sa.String(255))
|
||||
op.alter_column('ps_inbound_publications', 'endpoint', type_=sa.String(255))
|
||||
|
||||
op.alter_column('ps_outbound_publishes', 'id', type_=sa.String(255))
|
||||
op.alter_column('ps_outbound_publishes', 'outbound_auth', type_=sa.String(255))
|
||||
|
||||
op.alter_column('ps_registrations', 'id', type_=sa.String(255))
|
||||
op.alter_column('ps_registrations', 'outbound_auth', type_=sa.String(255))
|
||||
op.alter_column('ps_registrations', 'outbound_proxy', type_=sa.String(255))
|
||||
op.alter_column('ps_registrations', 'endpoint', type_=sa.String(255))
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.alter_column('ps_aors', 'id', type_=sa.String(40))
|
||||
op.alter_column('ps_aors', 'outbound_proxy', type_=sa.String(40))
|
||||
|
||||
op.alter_column('ps_auths', 'id', type_=sa.String(40))
|
||||
op.alter_column('ps_auths', 'realm', type_=sa.String(40))
|
||||
|
||||
op.alter_column('ps_contacts', 'outbound_proxy', type_=sa.String(40))
|
||||
op.alter_column('ps_contacts', 'endpoint', type_=sa.String(40))
|
||||
|
||||
op.alter_column('ps_domain_aliases', 'id', type_=sa.String(40))
|
||||
op.alter_column('ps_domain_aliases', 'domain', type_=sa.String(40))
|
||||
|
||||
op.alter_column('ps_endpoint_id_ips', 'id', type_=sa.String(40))
|
||||
op.alter_column('ps_endpoint_id_ips', 'endpoint', type_=sa.String(40))
|
||||
|
||||
op.alter_column('ps_endpoints', 'id', type_=sa.String(40))
|
||||
op.alter_column('ps_endpoints', 'aors', type_=sa.String(200))
|
||||
op.alter_column('ps_endpoints', 'auth', type_=sa.String(40))
|
||||
op.alter_column('ps_endpoints', 'outbound_auth', type_=sa.String(40))
|
||||
op.alter_column('ps_endpoints', 'outbound_proxy', type_=sa.String(40))
|
||||
|
||||
op.alter_column('ps_inbound_publications', 'id', type_=sa.String(40))
|
||||
op.alter_column('ps_inbound_publications', 'endpoint', type_=sa.String(40))
|
||||
|
||||
op.alter_column('ps_outbound_publishes', 'id', type_=sa.String(40))
|
||||
op.alter_column('ps_outbound_publishes', 'outbound_auth', type_=sa.String(40))
|
||||
|
||||
op.alter_column('ps_registrations', 'id', type_=sa.String(40))
|
||||
op.alter_column('ps_registrations', 'outbound_auth', type_=sa.String(40))
|
||||
op.alter_column('ps_registrations', 'outbound_proxy', type_=sa.String(40))
|
||||
op.alter_column('ps_registrations', 'endpoint', type_=sa.String(40))
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
"""Remove macrocontext field
|
||||
|
||||
Revision ID: 1c55c341360f
|
||||
Revises: 39428242f7f5
|
||||
Create Date: 2024-01-09 15:01:39.698918
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '1c55c341360f'
|
||||
down_revision = '39428242f7f5'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.drop_column('voicemail_messages', 'macrocontext')
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.add_column('voicemail_messages', sa.Column('macrocontext', sa.String(80)))
|
|
@ -1,59 +1,60 @@
|
|||
#!/usr/bin/env bash
|
||||
#!/bin/bash
|
||||
|
||||
# Turn on extended globbing
|
||||
shopt -s extglob
|
||||
shopt -s nullglob
|
||||
# Bail on any error
|
||||
set -e
|
||||
|
||||
prog=$(basename $0)
|
||||
prog=$(basename "$0")
|
||||
|
||||
# NOTE: <(cmd) is a bash construct that returns a temporary file name
|
||||
# from which the command output can be read. In this case, we're
|
||||
# extracting the block of text delimited by '#@@@FUNCSSTART@@@'
|
||||
# and '#@@@FUNCSEND@@@' from this file and 'source'ing it to
|
||||
# get some functions.
|
||||
source <(sed -n -r -e "/^#@@@FUNCSSTART@@@/,\${p;/^#@@@FUNCSEND@@@/q}" $0 | sed '1d;$d')
|
||||
|
||||
# The "!(*.txt)" is a bash construct that excludes files ending with .txt
|
||||
# from the glob match.
|
||||
declare -a COREDUMPS=( /tmp/core!(*.txt) )
|
||||
# shellcheck disable=SC1090
|
||||
source <(sed -n "/^#@@@FUNCSSTART@@@/,/^#@@@FUNCSEND@@@/ p" "$0" | sed '1d;$d')
|
||||
|
||||
# A line starting with ': ' is a POSIX construct that makes the shell
|
||||
# perform the operation but ignore the result. This is an alternative to
|
||||
# having to do RUNNING=${RUNNING:=false} to set defaults.
|
||||
|
||||
: ${ASTERISK_BIN:=$(which asterisk)}
|
||||
: ${DATEOPTS='-u +%FT%H-%M-%SZ'}
|
||||
: ${DELETE_COREDUMPS_AFTER:=false}
|
||||
: ${DELETE_RESULTS_AFTER:=false}
|
||||
: ${DRY_RUN:=false}
|
||||
: ${GDB:=$(which gdb)}
|
||||
: ${HELP:=false}
|
||||
: ${LATEST:=false}
|
||||
: ${OUTPUTDIR:=/tmp}
|
||||
: ${PROMPT:=true}
|
||||
: ${RUNNING:=false}
|
||||
: ${RENAME:=true}
|
||||
: ${TARBALL_CONFIG:=false}
|
||||
: ${TARBALL_COREDUMPS:=false}
|
||||
: ${TARBALL_RESULTS:=false}
|
||||
: "${DATEOPTS=-u +%FT%H-%M-%SZ}"
|
||||
: "${DELETE_COREDUMPS_AFTER:=false}"
|
||||
: "${DELETE_RESULTS_AFTER:=false}"
|
||||
: "${DRY_RUN:=false}"
|
||||
: "${GDB:=$(which gdb)}"
|
||||
: "${HELP:=false}"
|
||||
: "${LATEST:=false}"
|
||||
: "${OUTPUTDIR:=/tmp}"
|
||||
: "${PROMPT:=true}"
|
||||
: "${RUNNING:=false}"
|
||||
: "${RENAME:=true}"
|
||||
: "${TARBALL_CONFIG:=false}"
|
||||
: "${TARBALL_COREDUMPS:=false}"
|
||||
: "${TARBALL_RESULTS:=false}"
|
||||
: "${MODDIR:=}"
|
||||
: "${LIBDIR:=}"
|
||||
: "${ETCDIR:=}"
|
||||
|
||||
COMMANDLINE_COREDUMPS=false
|
||||
|
||||
# Read config files from most important to least important.
|
||||
# Variables set on the command line or environment always take precedence.
|
||||
# shellcheck disable=SC1091
|
||||
[ -f ./ast_debug_tools.conf ] && source ./ast_debug_tools.conf
|
||||
# shellcheck disable=SC1090
|
||||
[ -f ~/ast_debug_tools.conf ] && source ~/ast_debug_tools.conf
|
||||
[ -f /etc/asterisk/ast_debug_tools.conf ] && source /etc/asterisk/ast_debug_tools.conf
|
||||
|
||||
if [ -n "${DATEFORMAT}" ] ; then
|
||||
err <<-EOF
|
||||
The DATEFORMAT variable in your ast_debug_tools.conf file has been
|
||||
FYI... The DATEFORMAT variable in your ast_debug_tools.conf file has been
|
||||
replaced with DATEOPTS which has a different format. See the latest
|
||||
ast_debug_tools.conf sample file for more information.
|
||||
EOF
|
||||
fi
|
||||
|
||||
|
||||
for a in "$@" ; do
|
||||
if [[ $a == "--RUNNING" ]] ; then
|
||||
|
@ -61,13 +62,13 @@ for a in "$@" ; do
|
|||
PROMPT=false
|
||||
elif [[ $a =~ --no-([^=]+)$ ]] ; then
|
||||
var=${BASH_REMATCH[1]//-/_}
|
||||
eval ${var^^}="false"
|
||||
eval "${var^^}"="false"
|
||||
elif [[ $a =~ --([^=]+)$ ]] ; then
|
||||
var=${BASH_REMATCH[1]//-/_}
|
||||
eval ${var^^}="true"
|
||||
eval "${var^^}"="true"
|
||||
elif [[ $a =~ --([^=]+)=(.+)$ ]] ; then
|
||||
var=${BASH_REMATCH[1]//-/_}
|
||||
eval ${var^^}=${BASH_REMATCH[2]}
|
||||
eval "${var^^}"="${BASH_REMATCH[2]}"
|
||||
else
|
||||
if ! $COMMANDLINE_COREDUMPS ; then
|
||||
COMMANDLINE_COREDUMPS=true
|
||||
|
@ -82,21 +83,14 @@ if $HELP ; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC2218
|
||||
check_gdb
|
||||
|
||||
if [ -z "${ASTERISK_BIN}" -o ! -x "${ASTERISK_BIN}" ] ; then
|
||||
die -2 <<-EOF
|
||||
The asterisk binary specified (${ASTERISK_BIN})
|
||||
was not found or is not executable. Use the '--asterisk-bin'
|
||||
option to specify a valid binary.
|
||||
EOF
|
||||
fi
|
||||
|
||||
if [ $EUID -ne 0 ] ; then
|
||||
die -13 "You must be root to use $prog."
|
||||
fi
|
||||
|
||||
if [ -z "${OUTPUTDIR}" -o ! -d "${OUTPUTDIR}" ] ; then
|
||||
if [ -z "${OUTPUTDIR}" ] || [ ! -d "${OUTPUTDIR}" ] ; then
|
||||
die -20 "OUTPUTDIR ${OUTPUTDIR} doesn't exists or is not a directory"
|
||||
fi
|
||||
|
||||
|
@ -110,62 +104,127 @@ if $RUNNING ; then
|
|||
msg "Found a single asterisk instance running as process $MAIN_PID"
|
||||
|
||||
if $PROMPT ; then
|
||||
read -p "WARNING: Taking a core dump of the running asterisk instance will suspend call processing while the dump is saved. Do you wish to continue? (y/N) " answer
|
||||
read -r -p "WARNING: Taking a core dump of the running asterisk instance will suspend call processing while the dump is saved. Do you wish to continue? (y/N) " answer
|
||||
else
|
||||
answer=Y
|
||||
fi
|
||||
|
||||
if [[ "$answer" =~ ^[Yy] ]] ; then
|
||||
# shellcheck disable=SC2086
|
||||
df=$(date ${DATEOPTS})
|
||||
cf="${OUTPUTDIR}/core-asterisk-running-$df"
|
||||
echo "$(S_COR ${DRY_RUN} 'Simulating dumping' 'Dumping') running asterisk process to $cf"
|
||||
echo "$(S_COR "${DRY_RUN}" 'Simulating dumping' 'Dumping') running asterisk process to $cf"
|
||||
if ${DRY_RUN} ; then
|
||||
echo "Would run: ${GDB} ${ASTERISK_BIN} -p $MAIN_PID -q --batch --ex gcore $cf"
|
||||
echo "Would run: ${GDB} -p $MAIN_PID -q --batch --ex gcore $cf"
|
||||
else
|
||||
${GDB} ${ASTERISK_BIN} -p $MAIN_PID -q --batch --ex "gcore $cf" >/dev/null 2>&1
|
||||
${GDB} -p "$MAIN_PID" -q --batch --ex "gcore $cf" >/dev/null 2>&1
|
||||
fi
|
||||
echo "$(S_COR ${DRY_RUN} 'Simulated dump' 'Dump') is complete."
|
||||
|
||||
echo "$(S_COR "${DRY_RUN}" 'Simulated dump' 'Dump') is complete."
|
||||
|
||||
COREDUMPS=( "$cf" )
|
||||
|
||||
exe=$(extract_binary_name "${cf}")
|
||||
if [ -z "${exe}" ] ; then
|
||||
die -125 "Coredump produced has no executable!"
|
||||
fi
|
||||
|
||||
module_dir=$(extract_string_symbol "${exe}" "${cf}" ast_config_AST_MODULE_DIR)
|
||||
if [ ! -d "$module_dir" ] ; then
|
||||
die -125 "Couldn't get module directory from coredump!"
|
||||
fi
|
||||
else
|
||||
die -125 "Aborting dump of running process"
|
||||
fi
|
||||
|
||||
|
||||
$DRY_RUN && exit 0
|
||||
else
|
||||
|
||||
# If no coredumps were supplied on the command line or in
|
||||
# the ast_debug_tools.conf file, we'll use the default search.
|
||||
if [ ${#COREDUMPS[@]} -eq 0 ] ; then
|
||||
# The "!(*.txt)" is a bash construct that excludes files ending
|
||||
# with .txt from the glob match. Needs extglob set.
|
||||
mapfile -t COREDUMPS < <(readlink -f /tmp/core!(*.txt) | sort -u)
|
||||
fi
|
||||
|
||||
# At this point, all glob entries that match files should be expanded.
|
||||
# Any entries that don't exist are probably globs that didn't match anything
|
||||
# and need to be pruned. Any non coredumps are also pruned.
|
||||
|
||||
for i in ${!COREDUMPS[@]} ; do
|
||||
for i in "${!COREDUMPS[@]}" ; do
|
||||
if [ ! -f "${COREDUMPS[$i]}" ] ; then
|
||||
unset "COREDUMPS[$i]"
|
||||
continue
|
||||
fi
|
||||
# Some versions of 'file' don't allow only the first n bytes of the
|
||||
# file to be processed so we use dd to grab just the first 32 bytes.
|
||||
mimetype=$(dd if="${COREDUMPS[$i]}" bs=32 count=1 2>/dev/null | file -bi -)
|
||||
if [[ ! "$mimetype" =~ coredump ]] ; then
|
||||
unset "COREDUMPS[$i]"
|
||||
continue
|
||||
fi
|
||||
cf="${COREDUMPS[$i]}"
|
||||
|
||||
# Let's make sure it's an asterisk coredump by dumping the notes
|
||||
# section of the file and grepping for "asterisk".
|
||||
readelf -n "${COREDUMPS[$i]}" | grep -q "asterisk" || {
|
||||
msg "Examining ${cf}"
|
||||
|
||||
dump_note_strings "${cf}" | grep -q -E "app_dial|pbx_config" || {
|
||||
err " Doesn't appear to be an asterisk coredump"
|
||||
unset "COREDUMPS[$i]"
|
||||
continue
|
||||
}
|
||||
msg " Does appear to be an asterisk coredump"
|
||||
|
||||
# Let's get the executable from gdb "info proc".
|
||||
# We could have skipped the previous test and just checked
|
||||
# that the executable was "asterisk" but then, of course,
|
||||
# someone will decide that they need to change the executable
|
||||
# name to something else for some strange reason.
|
||||
exe=$(extract_binary_name "${cf}")
|
||||
if [ -z "${exe}" ] ; then
|
||||
err " Can't extract executable. Skipping."
|
||||
unset "COREDUMPS[$i]"
|
||||
continue
|
||||
fi
|
||||
msg " Coredump indicates executable '${exe}'"
|
||||
|
||||
# There's really only one reason --asterisk-bin might have
|
||||
# been specified and that is because the version of the binary
|
||||
# installed is newer than the one that caused the coredump in
|
||||
# which case, --asterisk-bin might be used to point to a saved
|
||||
# version of the correct binary.
|
||||
if [ -n "${ASTERISK_BIN}" ] ; then
|
||||
msg " but --asterisk-bin was specified so using '${ASTERISK_BIN}'"
|
||||
exe="${ASTERISK_BIN}"
|
||||
fi
|
||||
|
||||
msg " Searching for asterisk module directory"
|
||||
# Now let's get the modules directory.
|
||||
module_dir=$(extract_string_symbol "${exe}" "${cf}" \
|
||||
ast_config_AST_MODULE_DIR)
|
||||
# If ast_config_AST_MODULE_DIR couldn't be found, either the
|
||||
# coredump has no symbols or the coredump and exe don't match.
|
||||
# Either way, it's of no use to us.
|
||||
if [ ! -d "$module_dir" ] ; then
|
||||
err <<-EOF
|
||||
Can't extract asterisk module directory.
|
||||
Either the executable '${exe}' has no symbols
|
||||
or it's changed since the coredump was generated.
|
||||
Either way we can't use it. If you still have the
|
||||
binary that created this coredump, or can recreate
|
||||
the binary from the exact same code base and exact same
|
||||
options that were used to to create the binary that generated
|
||||
this coredump, specify its location with the
|
||||
--asterisk-bin option.
|
||||
EOF
|
||||
unset "COREDUMPS[$i]"
|
||||
continue
|
||||
fi
|
||||
msg " Found asterisk module directory '${module_dir}'"
|
||||
if [ -n "${MODDIR}" ] ; then
|
||||
msg " but --moddir was specified so using '${MODDIR}'"
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
if [ ${#COREDUMPS[@]} -eq 0 ] ; then
|
||||
die -2 "No coredumps found"
|
||||
die -2 "No valid coredumps found"
|
||||
fi
|
||||
|
||||
# Sort and weed out any dups
|
||||
COREDUMPS=( $(ls -t "${COREDUMPS[@]}" 2>/dev/null | uniq ) )
|
||||
# Make sure files actually exist then sort and weed out any dups
|
||||
mapfile -t COREDUMPS < <(readlink -e "${COREDUMPS[@]}" | sort -u)
|
||||
|
||||
if [ ${#COREDUMPS[@]} -eq 0 ] ; then
|
||||
die -2 "No coredumps found"
|
||||
|
@ -176,7 +235,6 @@ else
|
|||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [ ${#COREDUMPS[@]} -eq 0 ] ; then
|
||||
die -2 "No coredumps found"
|
||||
fi
|
||||
|
@ -184,41 +242,60 @@ fi
|
|||
# Extract the gdb scripts from the end of this script
|
||||
# and save them to /tmp/.gdbinit, then add a trap to
|
||||
# clean it up.
|
||||
|
||||
gdbinit=${OUTPUTDIR}/.ast_coredumper.gdbinit
|
||||
trap "rm $gdbinit" EXIT
|
||||
ss=`egrep -n "^#@@@SCRIPTSTART@@@" $0 |cut -f1 -d:`
|
||||
tail -n +${ss} $0 >$gdbinit
|
||||
trap 'rm $gdbinit' EXIT
|
||||
sed '1,/^#@@@SCRIPTSTART@@@/ d' "$0" >"$gdbinit"
|
||||
|
||||
# Now iterate over the coredumps and dump the debugging info
|
||||
for i in "${!COREDUMPS[@]}" ; do
|
||||
cf=$(realpath -e ${COREDUMPS[$i]} || : )
|
||||
cf=$(realpath -e "${COREDUMPS[$i]}" || : )
|
||||
if [ -z "$cf" ] ; then
|
||||
continue
|
||||
fi
|
||||
echo "Processing $cf"
|
||||
astbin="${ASTERISK_BIN}"
|
||||
[ -z "${astbin}" ] && astbin=$(extract_binary_name "${cf}")
|
||||
moddir="${MODDIR}"
|
||||
[ -z "${moddir}" ] && moddir=$(extract_string_symbol "${exe}" "${cf}" ast_config_AST_MODULE_DIR)
|
||||
etcdir="${ETCDIR}"
|
||||
[ -z "${etcdir}" ] && etcdir=$(extract_string_symbol "${exe}" "${cf}" ast_config_AST_CONFIG_DIR)
|
||||
libdir="${LIBDIR}"
|
||||
[ -z "${libdir}" ] && {
|
||||
libfile=$(dump_note_strings "${cf}" | grep -m 1 -E "libasteriskssl|libasteriskpj")
|
||||
libdir=$(dirname "${libfile}")
|
||||
}
|
||||
|
||||
msg " ASTBIN: $astbin"
|
||||
msg " MODDIR: $moddir"
|
||||
msg " ETCDIR: $etcdir"
|
||||
msg " LIBDIR: $libdir"
|
||||
|
||||
astbin_base=$(basename "${astbin}")
|
||||
if ! $RUNNING && ! [[ "$cf" =~ "running" ]] && $RENAME ; then
|
||||
df=$(date -r $cf ${DATEOPTS})
|
||||
# shellcheck disable=SC2086
|
||||
df=$(date -r "$cf" ${DATEOPTS})
|
||||
cfdir=$(dirname "$cf")
|
||||
newcf="${cfdir}/core-asterisk-${df}"
|
||||
newcf="${cfdir}/core-${astbin_base}-${df}"
|
||||
if [ "${newcf}" != "${cf}" ] ; then
|
||||
echo "Renaming $cf to $cfdir/core-asterisk-${df}"
|
||||
mv "$cf" "${cfdir}/core-asterisk-${df}"
|
||||
cf="${cfdir}/core-asterisk-${df}"
|
||||
msg " Renaming $cf to $cfdir/core-${astbin_base}-${df}"
|
||||
rm "${cfdir}/core-${astbin_base}-${df}" >/dev/null 2>&1 || :
|
||||
ln -s "$cf" "${cfdir}/core-${astbin_base}-${df}"
|
||||
cf="${cfdir}/core-${astbin_base}-${df}"
|
||||
fi
|
||||
fi
|
||||
|
||||
cfname=`basename ${cf}`
|
||||
cfname=$(basename "${cf}")
|
||||
|
||||
# Produce all the output files
|
||||
${GDB} -n --batch -q --ex "source $gdbinit" "${ASTERISK_BIN}" "$cf" 2>/dev/null | (
|
||||
${GDB} -n --batch -q --ex "source $gdbinit" "${astbin}" "$cf" 2>/dev/null | (
|
||||
of=/dev/null
|
||||
while IFS= read line ; do
|
||||
while IFS= read -r line ; do
|
||||
if [[ "$line" =~ !@!@!@!\ ([^\ ]+)\ !@!@!@! ]] ; then
|
||||
of=${OUTPUTDIR}/${cfname}-${BASH_REMATCH[1]}
|
||||
of=${of//:/-}
|
||||
rm -f "$of"
|
||||
echo "Creating $of"
|
||||
msg " Creating $of"
|
||||
fi
|
||||
echo -e $"$line" >> "$of"
|
||||
done
|
||||
|
@ -227,85 +304,54 @@ for i in "${!COREDUMPS[@]}" ; do
|
|||
if $TARBALL_COREDUMPS ; then
|
||||
# We need to change occurrences of ':' to '-' because
|
||||
# Jira won't let you attach a file with colons in the name.
|
||||
cfname=${cfname//:/-}
|
||||
tf=${OUTPUTDIR}/${cfname}.tar.gz
|
||||
echo "Creating ${tf}"
|
||||
|
||||
dest=${OUTPUTDIR}/${cfname}.output
|
||||
rm -rf ${dest} 2>/dev/null || :
|
||||
cfname="${cfname//:/-}"
|
||||
tf="${OUTPUTDIR}/${cfname}.tar.gz"
|
||||
echo " Creating ${tf}"
|
||||
|
||||
libdir=""
|
||||
dest="${OUTPUTDIR}/${cfname}.output"
|
||||
rm -rf "${dest}" 2>/dev/null || :
|
||||
|
||||
if [ -n "${LIBDIR}" ] ; then
|
||||
LIBDIR=$(realpath "${LIBDIR}")
|
||||
if [ ! -d "${LIBDIR}/asterisk/modules" ] ; then
|
||||
die -2 <<-EOF
|
||||
${LIBDIR}/asterisk/modules does not exist.
|
||||
The library specified by --libdir or LIBDIR ${LIBDIR})
|
||||
either does not exist or does not contain an "asterisk/modules" directory.
|
||||
EOF
|
||||
fi
|
||||
libdir=${LIBDIR}
|
||||
else
|
||||
abits=$(file -b ${ASTERISK_BIN} | sed -n -r -e "s/.*(32|64)-bit.*/\1/p")
|
||||
declare -a searchorder
|
||||
if [ $abits -eq 32 ] ; then
|
||||
searchorder=( /lib /usr/lib /usr/lib32 /usr/local/lib )
|
||||
else
|
||||
searchorder=( /usr/lib64 /usr/local/lib64 /usr/lib /usr/local/lib /lib )
|
||||
fi
|
||||
for d in ${searchorder[@]} ; do
|
||||
testmod="${d}/asterisk/modules/bridge_simple.so"
|
||||
if [ -e "${testmod}" ] ; then
|
||||
lbits=$(file -b ${ASTERISK_BIN} | sed -n -r -e "s/.*(32|64)-bit.*/\1/p")
|
||||
if [ $lbits -eq $abits ] ; then
|
||||
libdir=$d
|
||||
break;
|
||||
fi
|
||||
fi
|
||||
done
|
||||
astbindir=$(dirname "${astbin}")
|
||||
mkdir -p "${dest}/tmp" "${dest}/${moddir}" "${dest}/etc" \
|
||||
"${dest}/${etcdir}" "${dest}/${libdir}" "${dest}/${astbindir}"
|
||||
|
||||
if [ -z "${libdir}" ] ; then
|
||||
die -2 <<-EOF
|
||||
No standard systemlibrary directory contained asterisk modules.
|
||||
Please specify the correct system library directory
|
||||
with the --libdir option or the LIBDIR variable.
|
||||
${LIBDIR}/asterisk/modules must exist.
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
ln -s "${cf}" "${dest}/tmp/${cfname}"
|
||||
msg " Copying results files"
|
||||
cp "${OUTPUTDIR}/${cfname}"*.txt "${dest}/tmp/"
|
||||
[ -f /etc/os-release ] && {
|
||||
msg " Copying /etc/os-release"
|
||||
cp /etc/os-release "${dest}/etc/"
|
||||
}
|
||||
|
||||
mkdir -p ${dest}/tmp ${dest}/${libdir}/asterisk ${dest}/etc ${dest}/usr/sbin
|
||||
$TARBALL_CONFIG && {
|
||||
msg " Copying $etcdir"
|
||||
cp -a "${etcdir}"/* "${dest}/${etcdir}/"
|
||||
}
|
||||
|
||||
ln -s ${cf} ${dest}/tmp/${cfname}
|
||||
cp ${OUTPUTDIR}/${cfname}*.txt ${dest}/tmp/
|
||||
[ -f /etc/os-release ] && cp /etc/os-release ${dest}/etc/
|
||||
if $TARBALL_CONFIG ; then
|
||||
cp -a /etc/asterisk ${dest}/etc/
|
||||
fi
|
||||
cp -a /${libdir}/libasterisk* ${dest}/${libdir}/
|
||||
cp -a /${libdir}/asterisk/* ${dest}/${libdir}/asterisk/
|
||||
cp -a /usr/sbin/asterisk ${dest}/usr/sbin
|
||||
rm -rf ${tf}
|
||||
tar -chzf ${tf} --transform="s/^[.]/${cfname}.output/" -C ${dest} .
|
||||
msg " Copying ${libdir}/libasterisk*"
|
||||
cp -a "${libdir}/libasterisk"* "${dest}/${libdir}/"
|
||||
msg " Copying ${moddir}"
|
||||
cp -a "${moddir}"/* "${dest}/${moddir}/"
|
||||
msg " Copying ${astbin}"
|
||||
cp -a "${astbin}" "${dest}/${astbin}"
|
||||
rm -rf "${tf}"
|
||||
msg " Creating ${tf}"
|
||||
tar -chzf "${tf}" --transform="s/^[.]/${cfname}.output/" -C "${dest}" .
|
||||
sleep 3
|
||||
rm -rf ${dest}
|
||||
echo "Created $tf"
|
||||
rm -rf "${dest}"
|
||||
msg " Created $tf"
|
||||
elif $TARBALL_RESULTS ; then
|
||||
cfname=${cfname//:/-}
|
||||
tf=${OUTPUTDIR}/${cfname}.tar.gz
|
||||
echo "Creating ${tf}"
|
||||
cfname="${cfname//:/-}"
|
||||
tf="${OUTPUTDIR}/${cfname}.tar.gz"
|
||||
msg " Creating ${tf}"
|
||||
|
||||
dest=${OUTPUTDIR}/${cfname}.output
|
||||
rm -rf ${dest} 2>/dev/null || :
|
||||
mkdir -p ${dest}
|
||||
cp ${OUTPUTDIR}/${cfname}*.txt ${dest}/
|
||||
if $TARBALL_CONFIG ; then
|
||||
mkdir -p ${dest}/etc
|
||||
cp -a /etc/asterisk ${dest}/etc/
|
||||
fi
|
||||
tar -chzf ${tf} --transform="s/^[.]/${cfname}/" -C ${dest} .
|
||||
rm -rf ${dest}
|
||||
dest="${OUTPUTDIR}/${cfname}.output"
|
||||
rm -rf "${dest}" 2>/dev/null || :
|
||||
mkdir -p "${dest}"
|
||||
cp "${OUTPUTDIR}/${cfname}"*.txt "${dest}/"
|
||||
tar -chzf "${tf}" --transform="s/^[.]/${cfname}/" -C "${dest}" .
|
||||
rm -rf "${dest}"
|
||||
echo "Created $tf"
|
||||
fi
|
||||
|
||||
|
@ -314,7 +360,7 @@ for i in "${!COREDUMPS[@]}" ; do
|
|||
fi
|
||||
|
||||
if $DELETE_RESULTS_AFTER ; then
|
||||
to_delete=$cf
|
||||
to_delete="$cf"
|
||||
if [ -n "$OUTPUTDIR" ] ; then
|
||||
to_delete="$OUTPUTDIR/$cfname"
|
||||
fi
|
||||
|
@ -326,11 +372,7 @@ exit
|
|||
# @formatter:off
|
||||
|
||||
#@@@FUNCSSTART@@@
|
||||
print_help() {
|
||||
sed -n -r -e "/^#@@@HELPSTART@@@/,\${p;/^#@@@HELPEND@@@/q}" $0 | sed '1d;$d'
|
||||
exit 1
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2317
|
||||
err() {
|
||||
if [ -z "$1" ] ; then
|
||||
cat >&2
|
||||
|
@ -340,6 +382,7 @@ err() {
|
|||
return 0
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2317
|
||||
msg() {
|
||||
if [ -z "$1" ] ; then
|
||||
cat
|
||||
|
@ -349,15 +392,17 @@ msg() {
|
|||
return 0
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2317
|
||||
die() {
|
||||
if [[ $1 =~ ^-([0-9]+) ]] ; then
|
||||
RC=${BASH_REMATCH[1]}
|
||||
shift
|
||||
fi
|
||||
err "$1"
|
||||
exit ${RC:-1}
|
||||
exit "${RC:-1}"
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2317
|
||||
S_COR() {
|
||||
if $1 ; then
|
||||
echo -n "$2"
|
||||
|
@ -366,6 +411,7 @@ S_COR() {
|
|||
fi
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2317
|
||||
check_gdb() {
|
||||
if [ -z "${GDB}" -o ! -x "${GDB}" ] ; then
|
||||
die -2 <<-EOF
|
||||
|
@ -384,15 +430,18 @@ check_gdb() {
|
|||
fi
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2317
|
||||
find_pid() {
|
||||
if [ -n "$PID" ] ; then
|
||||
# Make sure it's at least all numeric
|
||||
[[ $PID =~ ^[0-9]+$ ]] || die -22 $"Pid $PID is invalid."
|
||||
# Make sure it exists
|
||||
cmd=$(ps -p $PID -o comm=) || die -22 "Pid $PID is not a valid process."
|
||||
# Make sure the program (without path) is "asterisk"
|
||||
[ "$cmd" == "asterisk" ] || die -22 "Pid $PID is '$cmd' not 'asterisk'."
|
||||
echo $PID
|
||||
cmd=$(ps -p "$PID" -o comm=) || die -22 "Pid $PID is not a valid process."
|
||||
# Make sure the program is "asterisk" by looking for common modules
|
||||
# in /proc/$PID/maps
|
||||
grep -q -E "app_dial|pbx_config" "/proc/$PID/maps" || \
|
||||
die -22 "Pid $PID '$cmd' not 'asterisk'."
|
||||
echo "$PID"
|
||||
return 0
|
||||
fi
|
||||
|
||||
|
@ -400,7 +449,7 @@ find_pid() {
|
|||
# so we'll just get the pids that exactly match a program
|
||||
# name of "asterisk".
|
||||
pids=$( pgrep -d ',' -x "asterisk")
|
||||
if [ -z ${pids} ] ; then
|
||||
if [ -z "${pids}" ] ; then
|
||||
die -3 <<-EOF
|
||||
No running asterisk instances detected.
|
||||
If you know the pid of the process you want to dump,
|
||||
|
@ -411,7 +460,7 @@ find_pid() {
|
|||
# Now that we have the pids, let's get the command and
|
||||
# its args. We'll add them to an array indexed by pid.
|
||||
declare -a candidates
|
||||
while read LINE ; do
|
||||
while read -r LINE ; do
|
||||
[[ $LINE =~ ([0-9]+)[\ ]+([^\ ]+)[\ ]+(.*) ]] || continue
|
||||
pid=${BASH_REMATCH[1]}
|
||||
prog=${BASH_REMATCH[2]}
|
||||
|
@ -422,7 +471,7 @@ find_pid() {
|
|||
# filter to weed out remote consoles.
|
||||
[[ "$prog" == "rasterisk" ]] && continue;
|
||||
candidates[$pid]="${prog}^${args}"
|
||||
done < <(ps -o pid= -o command= -p $pids)
|
||||
done < <(ps -o pid= -o command= -p "$pids")
|
||||
|
||||
if [ ${#candidates[@]} -eq 0 ] ; then
|
||||
die -3 <<-EOF
|
||||
|
@ -436,29 +485,77 @@ find_pid() {
|
|||
die -22 <<-EOF
|
||||
Detected more than one asterisk process running.
|
||||
$(printf "%8s %s\n" "PID" "COMMAND")
|
||||
$(for p in ${!candidates[@]} ; do printf "%8s %s\n" $p "${candidates[$p]//^/ }" ; done )
|
||||
$(for p in "${!candidates[@]}" ; do printf "%8s %s\n" $p "${candidates[$p]//^/ }" ; done )
|
||||
If you know the pid of the process you want to dump,
|
||||
supply it on the command line with --pid=<pid>.
|
||||
EOF
|
||||
fi
|
||||
|
||||
echo ${!candidates[@]}
|
||||
echo "${!candidates[@]}"
|
||||
return 0
|
||||
}
|
||||
#@@@FUNCSEND@@@
|
||||
|
||||
#@@@HELPSTART@@@
|
||||
# extract_binary_name <coredump>
|
||||
# shellcheck disable=SC2317
|
||||
extract_binary_name() {
|
||||
${GDB} -c "$1" -q --batch -ex "info proc exe" 2>/dev/null \
|
||||
| sed -n -r -e "s/exe\s*=\s*'([^ ]+).*'/\1/gp"
|
||||
return 0
|
||||
}
|
||||
|
||||
# extract_string_symbol <binary> <coredump> <symbol>
|
||||
# shellcheck disable=SC2317
|
||||
extract_string_symbol() {
|
||||
${GDB} "$1" "$2" -q --batch \
|
||||
-ex "p $3" 2>/dev/null \
|
||||
| sed -n -r -e 's/[$]1\s*=\s*[0-9a-fx]+\s+<[^>]+>\s+"([^"]+)"/\1/gp'
|
||||
return 0
|
||||
}
|
||||
|
||||
# The note0 section of the coredump has the map of shared
|
||||
# libraries to address so we can find that section with
|
||||
# objdump, dump it with dd, extract the strings, and
|
||||
# search for common asterisk modules. This is quicker
|
||||
# that just running strings against the entire coredump
|
||||
# which could be many gigabytes in length.
|
||||
|
||||
# dump_note_strings <coredump> [ <min string length> ]
|
||||
# shellcheck disable=SC2317
|
||||
dump_note_strings() {
|
||||
note0=$(objdump -h "$1" | grep note0)
|
||||
|
||||
# The header we're interested in will look like this...
|
||||
# Idx Name Size VMA LMA File off Algn
|
||||
# 0 note0 00033364 0000000000000000 0000000000000000 0000de10 2**0
|
||||
# We want size and offset
|
||||
|
||||
[[ "${note0}" =~ ^[\ \t]*[0-9]+[\ \t]+note0[\ \t]+([0-9a-f]+)[\ \t]+[0-9a-f]+[\ \t]+[0-9a-f]+[\ \t]+([0-9a-f]+) ]] || {
|
||||
return 1
|
||||
}
|
||||
count=$((0x${BASH_REMATCH[1]}))
|
||||
skip=$((0x${BASH_REMATCH[2]}))
|
||||
|
||||
dd if="$1" bs=1 count="$count" skip="$skip" 2>/dev/null | strings -n "${2:-8}"
|
||||
return 0
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2317
|
||||
print_help() {
|
||||
cat <<EOF
|
||||
NAME
|
||||
$prog - Dump and/or format asterisk coredump files
|
||||
|
||||
SYNOPSIS
|
||||
$prog [ --help ] [ --running | --RUNNING ] [ --pid="pid" ]
|
||||
[ --latest ] [ --OUTPUTDIR="path" ]
|
||||
[ --libdir="path" ] [ --asterisk-bin="path" ]
|
||||
[ --gdb="path" ] [ --rename ] [ --dateformat="date options" ]
|
||||
$prog [ --help ] [ --running | --RUNNING ] [ --pid=<pid> ]
|
||||
[ --latest ] [ --outputdir=<path> ]
|
||||
[ --asterisk-bin=<path to asterisk binary that created the coredump> ]
|
||||
[ --moddir=<path to asterisk modules directory that created the coredump> ]
|
||||
[ --libdir=<path to directory containing libasterisk* libraries> ]
|
||||
[ --gdb=<path to gdb> ] [ --rename ] [ --dateformat=<date options> ]
|
||||
[ --tarball-coredumps ] [ --delete-coredumps-after ]
|
||||
[ --tarball-results ] [ --delete-results-after ]
|
||||
[ --tarball-config ]
|
||||
[ --etcdir=<path to directory containing asterisk config files> ]
|
||||
[ <coredump> | <pattern> ... ]
|
||||
|
||||
DESCRIPTION
|
||||
|
@ -507,16 +604,25 @@ DESCRIPTION
|
|||
The directory into which output products will be saved.
|
||||
Default: same directory as coredump
|
||||
|
||||
--libdir=<shared libs directory>
|
||||
The directory where the libasterisk* shared libraries and
|
||||
the asterisk/modules directory are located. The common
|
||||
directories like /usr/lib, /usr/lib64, etc are automatically
|
||||
searches so only use this option when your asterisk install
|
||||
is non-standard.
|
||||
--asterisk-bin=<path to asterisk binary that created the coredump>
|
||||
You should only need to use this if the asterisk binary on
|
||||
the system has changed since the coredump was generated.
|
||||
In this case, the symbols won't be valid and the coredump
|
||||
will be useless. If you can recreate the binary with
|
||||
the exact same source code and compile options, or you have
|
||||
a saved version, you can use this option to use that binary
|
||||
instead.
|
||||
Default: executable path extracted from coredump
|
||||
|
||||
--asterisk-bin=<asterisk binary>
|
||||
Path to the asterisk binary.
|
||||
Default: look for asterisk in the PATH.
|
||||
--moddir=<path to asterisk modules directory>
|
||||
You should only need to use this for the same reason you'd
|
||||
need to use --asterisk-bin.
|
||||
Default: "astmoddir" directory extracted from coredump
|
||||
|
||||
--libdir=<path to directory containing libasterisk* libraries>
|
||||
You should only need to use this for the same reason you'd
|
||||
need to use --asterisk-bin.
|
||||
Default: libdir extracted from coredump
|
||||
|
||||
--gdb=<path_to_gdb>
|
||||
gdb must have python support built-in. Most do.
|
||||
|
@ -542,6 +648,19 @@ DESCRIPTION
|
|||
WARNING: This file could be quite large!
|
||||
Mutually exclusive with --tarball-results
|
||||
|
||||
--tarball-config
|
||||
Adds the contents of /etc/asterisk to the tarball created
|
||||
with --tarball-coredumps.
|
||||
WARNING: This may include confidential information like
|
||||
secrets or keys.
|
||||
|
||||
--etcdir=<path to directory asterisk config files>
|
||||
If you use --tarball-config and the config files that
|
||||
match this coredump are in a location other than that which
|
||||
was specified in "astetcdir" in asterisk.conf, you can use
|
||||
this option to point to their current location.
|
||||
Default: "astetcdir" extracted from coredump.
|
||||
|
||||
--delete-coredumps-after
|
||||
Deletes all processed coredumps regardless of whether
|
||||
a tarball was created.
|
||||
|
@ -558,15 +677,9 @@ DESCRIPTION
|
|||
to use this option unless you have also specified
|
||||
--tarball-results.
|
||||
|
||||
--tarball-config
|
||||
Adds the contents of /etc/asterisk to the tarball created
|
||||
with --tarball-coredumps or --tarball-results.
|
||||
|
||||
<coredump> | <pattern>
|
||||
A list of coredumps or coredump search patterns. These
|
||||
will override the default and those specified in the config files.
|
||||
|
||||
The default pattern is "/tmp/core!(*.txt)"
|
||||
will override the default of "/tmp/core!(*.txt)"
|
||||
|
||||
The "!(*.txt)" tells bash to ignore any files that match
|
||||
the base pattern and end in ".txt". It$'s not strictly
|
||||
|
@ -583,7 +696,6 @@ NOTES
|
|||
Examples:
|
||||
TARBALL_RESULTS=true
|
||||
RENAME=false
|
||||
ASTERISK_BIN=/usr/sbin/asterisk
|
||||
|
||||
The script relies on not only bash, but also recent GNU date and
|
||||
gdb with python support. *BSD operating systems may require
|
||||
|
@ -602,7 +714,10 @@ FILES
|
|||
See the configs/samples/ast_debug_tools.conf file in the asterisk
|
||||
source tree for more info.
|
||||
|
||||
#@@@HELPEND@@@
|
||||
EOF
|
||||
}
|
||||
|
||||
#@@@FUNCSEND@@@
|
||||
|
||||
# Be careful editing the inline scripts.
|
||||
# They're space-indented.
|
||||
|
|
|
@ -192,10 +192,7 @@ check_installed_debs() {
|
|||
for pack in "$@" ; do
|
||||
tocheck="${tocheck} ^${pack}$ ~P^${pack}$"
|
||||
done
|
||||
pkgs=$(aptitude -F '%c %p' search ${tocheck} 2>/dev/null | awk '/^p/{print $2}')
|
||||
if [ ${#pkgs} -ne 0 ]; then
|
||||
echo $pkgs | sed -r -e "s/ ?[^ :]+:i386//g"
|
||||
fi
|
||||
aptitude -F '%c %p' search $tocheck 2>/dev/null | awk '/^p/{print $2}' | grep -vF :
|
||||
}
|
||||
|
||||
# parsing the output of yum is close to impossible.
|
||||
|
|
|
@ -221,7 +221,7 @@ samples)
|
|||
sed -r -i \
|
||||
-e '/^\[directories\]\(!\)/s/\(!\).*//' \
|
||||
-e "/^\[directories\]/a; rem-out any of the following to use Asterisk's defaults:" \
|
||||
-e "/^ast(etc|mod|varlib|data|agi|run|spool|log|db|key)dir\>/s| /| $BASE_DIR/|" \
|
||||
-e "/^ast(cache|etc|mod|varlib|data|agi|run|spool|log|db|key)dir\>/s| /| $BASE_DIR/|" \
|
||||
"$AST_CONF"
|
||||
if [ "$LIVE_AST_FOR_SYSTEM" != '' ]; then
|
||||
sed -r -i \
|
||||
|
|
|
@ -97,7 +97,7 @@ else
|
|||
|
||||
if test ! -d "${ASTVARRUNDIR}"; then
|
||||
mkdir -p "${ASTVARRUNDIR}"
|
||||
chmod 770 "${ASTVARRUNDIR}"
|
||||
chmod 755 "${ASTVARRUNDIR}"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
## **DO NOT REMOVE THIS FILE!**
|
||||
|
||||
The only files that should be added to this directory are ones that will be
|
||||
used by the release script to update the CHANGES file automatically. The only
|
||||
time that it is necessary to add something to the CHANGES-staging directory is
|
||||
if you are either adding a new feature to Asterisk or adding new functionality
|
||||
to an existing feature. The file does not need to have a meaningful name, but
|
||||
it probably should. If there are multiple items that need documenting, you can
|
||||
add multiple files, each with their own description. If the message is going to
|
||||
be the same for each subject, then you can add multiple subject headers to one
|
||||
file. The "Subject: xxx" line is case sensitive! For example, if you are making
|
||||
a change to PJSIP, then you might add the file "res_pjsip_my_cool_feature.txt" to
|
||||
this directory, with a short description of what it does. The files must have
|
||||
the ".txt" suffix. If you are adding multiple entries, they should be done in
|
||||
the same commit to avoid merge conflicts. Here's an example:
|
||||
|
||||
> Subject: res_pjsip
|
||||
> Subject: Core
|
||||
>
|
||||
> Here's a pretty good description of my new feature that explains exactly what
|
||||
> it does and how to use it.
|
||||
|
||||
Here's a master-only example:
|
||||
|
||||
> Subject: res_ari
|
||||
> Master-Only: True
|
||||
>
|
||||
> This change will only go into the master branch. The "Master-Only" header
|
||||
> will never be in a change not in master.
|
||||
|
||||
Note that the second subject has another header: "Master-Only". Changes that go
|
||||
into the master branch and ONLY the master branch are the only ones that should
|
||||
have this header. Also, the value can only be "true" or "True". The
|
||||
"Master-Only" part of the header IS case-sensitive, however!
|
||||
|
||||
For more information, check out the wiki page:
|
||||
https://wiki.asterisk.org/wiki/display/AST/CHANGES+and+UPGRADE.txt
|
|
@ -1,4 +0,0 @@
|
|||
Subject: app_senddtmf
|
||||
|
||||
The SendFlash AMI action now allows sending
|
||||
a hook flash event on a channel.
|
|
@ -1,5 +0,0 @@
|
|||
Subject: pbx_builtins
|
||||
|
||||
It is now possible to not wait for media on
|
||||
a channel when answering it using Answer,
|
||||
by specifying the i option.
|
|
@ -1,5 +0,0 @@
|
|||
Subject: app_amd
|
||||
|
||||
An audio file to play during AMD processing can
|
||||
now be specified to the AMD application or configured
|
||||
in the amd.conf configuration file.
|
|
@ -1,4 +0,0 @@
|
|||
Subject: app_bridgewait
|
||||
|
||||
Adds the n option to not answer the channel when
|
||||
the BridgeWait application is called.
|
|
@ -1,4 +0,0 @@
|
|||
Subject: app_broadcast
|
||||
|
||||
A Broadcast application is now available which allows
|
||||
for asynchronous one-to-many and many-to-one channel audio.
|
|
@ -1,5 +0,0 @@
|
|||
Subject: app_confbridge
|
||||
|
||||
Adds the end_marked_any option which can be used
|
||||
to kick users from a conference after any
|
||||
marked user leaves (including marked users).
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue