> ## Documentation Index
> Fetch the complete documentation index at: https://docs.diga.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Sip Config

> Update SIP trunk configuration for an imported phone number.

Updates LiveKit trunks first, then persists to database.
Only custom/imported phones can have their SIP config updated.



## OpenAPI

````yaml /api-reference/openapi.json patch /v1/phone/{phone_id}/sip-config
openapi: 3.1.0
info:
  title: Diga API
  version: 0.1.0
servers:
  - url: https://api.diga.io
    description: Production
security: []
paths:
  /v1/phone/{phone_id}/sip-config:
    patch:
      tags:
        - Phones
      summary: Update Sip Config
      description: |-
        Update SIP trunk configuration for an imported phone number.

        Updates LiveKit trunks first, then persists to database.
        Only custom/imported phones can have their SIP config updated.
      operationId: update_sip_config_v1_phone__phone_id__sip_config_patch
      parameters:
        - name: phone_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Phone Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchSipConfigRequestSchema'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PhoneRegisterResponseSchema'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - CustomHTTPBearer: []
components:
  schemas:
    PatchSipConfigRequestSchema:
      properties:
        inbound_config:
          anyOf:
            - $ref: '#/components/schemas/InboundConfigUpdateSchema'
            - type: 'null'
          title: Inbound Configuration
          description: Incoming call configuration fields to update
        outbound_config:
          anyOf:
            - $ref: '#/components/schemas/OutboundConfigUpdateSchema'
            - type: 'null'
          title: Outbound Configuration
          description: Outgoing call configuration fields to update
      type: object
      title: PatchSipConfigRequestSchema
    PhoneRegisterResponseSchema:
      properties:
        id:
          type: string
          format: uuid
          title: Phone Register ID
          description: Unique identifier for the phone register record
        nickname:
          anyOf:
            - type: string
            - type: 'null'
          title: Nickname
          description: The nickname given to the phone number
        number:
          type: string
          title: Phone Number
          description: The phone number or SIP identifier
        telephony_provider:
          $ref: '#/components/schemas/TelephonyProvider'
          title: Telephony Provider
          description: >-
            The telephony provider (NETELIP for purchased numbers, CUSTOM for
            imported numbers)
        status:
          $ref: '#/components/schemas/PhoneRegisterStatus'
          title: Status
          description: >-
            Current status of the phone register (RESERVED, ASSIGNED, RELEASED,
            FINISHED)
        released_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Released At
          description: The date and time when the phone was released
        scheduled_release_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Scheduled Release At
          description: >-
            The date and time when the phone is scheduled to be released. If
            set, the phone will be released at this time at the end of the
            billing period.
        assigned_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Assigned At
          description: The date and time when the phone was assigned
        inbound_agent_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Inbound Agent ID
          description: >-
            The unique identifier for the agent that will receive the call when
            this phone receives an inbound call
        outbound_agent_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Outbound Agent ID
          description: >-
            The unique identifier for the agent that will make the calls when
            using this phone to make outbound calls
        sip_config:
          anyOf:
            - $ref: '#/components/schemas/SipConfigResponseSchema'
            - type: 'null'
          title: SIP Configuration
          description: SIP trunk configuration details (only for custom/imported phones)
      type: object
      required:
        - id
        - number
        - telephony_provider
        - status
      title: PhoneRegisterResponseSchema
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    InboundConfigUpdateSchema:
      properties:
        media_encryption:
          anyOf:
            - $ref: '#/components/schemas/SipMediaEncryption'
            - type: 'null'
          title: Media Encryption
          description: Whether to encrypt media (SRTP) for inbound calls
        allowed_addresses:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Allowed Addresses
          description: List of IP addresses or CIDR blocks allowed for inbound SIP traffic
      type: object
      title: InboundConfigUpdateSchema
    OutboundConfigUpdateSchema:
      properties:
        termination_uri:
          anyOf:
            - type: string
            - type: 'null'
          title: Termination URI
          description: >-
            Hostname or IP where SIP INVITE is sent for outbound calls. Do not
            include the sip: or sips: prefix.
        username:
          anyOf:
            - type: string
            - type: 'null'
          title: SIP Auth Username
          description: SIP trunk username for digest authentication
        password:
          anyOf:
            - type: string
            - type: 'null'
          title: SIP Auth Password
          description: SIP trunk password for digest authentication
        media_encryption:
          anyOf:
            - $ref: '#/components/schemas/SipMediaEncryption'
            - type: 'null'
          title: Media Encryption
          description: Whether to encrypt media (SRTP) for outbound calls
      type: object
      title: OutboundConfigUpdateSchema
    TelephonyProvider:
      type: string
      enum:
        - netelip
        - custom
      title: TelephonyProvider
    PhoneRegisterStatus:
      type: string
      enum:
        - reserved
        - assigned
        - released
        - finished
      title: PhoneRegisterStatus
      description: >-
        Enum representing the status of a phone number register. The cycle is as
        follows:

        - RESERVED: The phone number is reserved for a certain amount of time
        before being assigned

        - ASSIGNED: The phone number is assigned to a company

        - RELEASED: The phone number is released from the company and is pending
        availability for purchase (30 days before it can be purchased again)

        - FINISHED: The phone register process is finished, and the phone number
        is available for purchase again. Once a phone number reaches this
        status, it cannot return to previous statuses.
    SipConfigResponseSchema:
      properties:
        termination_uri:
          anyOf:
            - type: string
            - type: 'null'
          title: Termination URI
          description: Hostname or IP where SIP INVITE is sent for outbound calls
        username:
          anyOf:
            - type: string
            - type: 'null'
          title: SIP Auth Username
          description: SIP trunk username for digest authentication
        inbound_media_encryption:
          $ref: '#/components/schemas/SipMediaEncryption'
          title: Inbound Media Encryption
          description: Media encryption setting for inbound calls
          default: allow
        outbound_media_encryption:
          $ref: '#/components/schemas/SipMediaEncryption'
          title: Outbound Media Encryption
          description: Media encryption setting for outbound calls
          default: allow
        allowed_addresses:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Allowed Addresses
          description: IP addresses or CIDR blocks allowed for inbound SIP traffic
      type: object
      title: SipConfigResponseSchema
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    SipMediaEncryption:
      type: string
      enum:
        - disable
        - allow
        - require
      title: SipMediaEncryption
  securitySchemes:
    CustomHTTPBearer:
      type: http
      scheme: bearer

````